[
https://issues.apache.org/jira/browse/PDFBOX-4073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333499#comment-16333499
]
Andreas Lehmkühler commented on PDFBOX-4073:
--------------------------------------------
I agree with Tilman. I don't see any need for that (and I am using PDFBox to
create PDFs for more than 10 years) on the contrary it would make things much
more complicated for us. We already have to convert such values as PDF uses
different (coordinate) systems (user, device, font etc.) under the hood.
Furthermore we have to think about what methods should provide such feature as
it doesn't necessarily make sense in each case, see your own piece of code
setFont vs newLineAtOffset. To sum it up, we would have to add a lot of more or
less complicated/error-prone code which I'd like to avoid.
> Choosable Coordinate-Unitsystem (mm,inches,...?)
> ------------------------------------------------
>
> Key: PDFBOX-4073
> URL: https://issues.apache.org/jira/browse/PDFBOX-4073
> Project: PDFBox
> Issue Type: New Feature
> Reporter: Sven Jeppsson
> Priority: Minor
> Attachments: unitconverter.patch
>
>
> Hey,
> I want to suggest a feature.
> I guess many people prefer to directly work with "mm" or "inches" instead of
> points. The common approach is to create an converter or ratio-Constant and
> convert at any place the "mm" or "inches" to points.
> I suggest an other approacher, what do you think about an central setting of
> an "unitconverter" so that every coordinate is converted deep inside shortly
> before rendering?
> I created a patch based on the 3.0.0-SNAPSHOT in
> [https://github.com/apache/pdfbox.git]
> I don't know the API enough to change all related Codelines. But this patch
> should give an Idea what i mean.
> For this approach I ignored:
> * that actually die "PDPage" mediabox shoud be converted too.
> * the Matrix arguments
>
> {code:java}
> // Usage example
> UnitConverter.activeConverter=UnitConverter.MM_CONVERTER;
> try (PDDocument doc = new PDDocument())
> {
> PDPage page = new PDPage(PDRectangle.A4); // works still unconverted
> doc.addPage(page);
>
> PDFont font = PDType1Font.HELVETICA_BOLD;
> try (PDPageContentStream contents = new PDPageContentStream(doc, page))
> {
> contents.beginText();
> contents.setFont(font, 12); //we are used to fontsizes, i would not
> use a converter here
> contents.newLineAtOffset(10, 10);// x=10mm,y=10mm
> contents.showText(message);
> contents.endText();
> }
>
> doc.save(filename);
> }
> {code}
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]