[ 
https://issues.apache.org/jira/browse/PDFBOX-4073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333428#comment-16333428
 ] 

Sven Jeppsson commented on PDFBOX-4073:
---------------------------------------

you are right it is not critical. But i still think it is a realy a NICE TO 
HAVE. 

The priority Levels (blocker, critical, trivial ...) don´t fit to Feature 
requests. they just fit to Bugs. So i came in trouble  choosing the correct 
priority. Sorry about that.

I actually dont care for Inches, I work with militmeters. Of Course it is easy 
to write i method , that is called mm or Inch that calc the mm to Points. But 
you have to call very often in the Code,

There is not Need to do "try and error" even if there is no unitconverter. But 
the Code ist more "readable" with the setable Standard unitconverter.

Is Tilman Hausherr the only one, who has a look inside this ticket?

What do other think about my idea?

 

 

> 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]

Reply via email to