pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PdfBox 2.0 scale to A4 while printing document
Date Sun, 28 Jun 2015 21:43:26 GMT
Thanks... I wonder what we'll do in the countries that don't use A4? 
According to wikipedia, this is North America, Bolivia, Colombia, 
Panama, Venezuela, the Philippines, Costa Rica, Dominican Republic, and 
Chile. We'd need to set up some default that will work in any country, 
e.g. by getting the values from the print dialog or whatever.

Tilman

Am 28.06.2015 um 20:04 schrieb Alex Sviridov:
>   Uff! I have finally made it to work. The following code prints with normal margins:
>
>              PrinterJob job = PrinterJob.getPrinterJob();
>              Paper paper=new Paper();
>              paper.setSize(72d*8.267d, 72d*11.692d);
>              paper.setImageableArea(0,0,72d*8.267d, 72d*11.692d);
>              
>              PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();
>              attr_set.add(MediaSizeName.ISO_A4);
>              attr_set.add(Sides.ONE_SIDED);
>              
>              PDFPrinter pDFPrinter=new PDFPrinter(document,Scaling.SCALE_TO_FIT, Orientation.PORTRAIT,paper);
>              pDFPrinter.silentPrint(attr_set);
>
>
>
> Воскресенье, 28 июня 2015, 19:40 +02:00 от Tilman Hausherr <THausherr@t-online.de>:
>> Thanks, I have opened an issue in JIRA. I can confirm it, and it is only
>> in 2.0, not on 1.8 (which doesn't help, because 1.8 doesn't render your
>> fonts properly)
>>
>> https://issues.apache.org/jira/browse/PDFBOX-2844
>>
>> Tilman
>>
>> Am 28.06.2015 um 18:01 schrieb Alex Sviridov:
>>>    The file I tested is here  https://yadi.sk/i/iX-KJwlhhXMY2
>>>
>>> I printed this pdf file with Adobe Reader in mode 100%. And as expected left
and right margins are about 2cm. In comparison when I print using pdfbox left margin is 4.5cm,
right about 3.5cm.
>>>
>>> The code I use :
>>> PrinterJob job = PrinterJob.getPrinterJob();
>>> Paper paper=new Paper();
>>> paper.setSize(72d*8.267d, 72d*11.692);
>>> PDFPrinter pDFPrinter=new PDFPrinter(document,Scaling.SCALE_TO_FIT, Orientation.PORTRAIT,paper);
>>> pDFPrinter.silentPrint(job);
>>>
>>> Questions:
>>> 1) how can I make pdfbox to SCALE_TO_FIT?
>>> 2) how can I print only certain page - not entire document?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Воскресенье, 28 июня 2015, 17:40 +02:00 от Tilman Hausherr <
THausherr@t-online.de >:
>>>> Hi,
>>>>
>>>> Something is indeed a bit tricky with your mailing software, your own
>>>> comments are mixed with my comments. But I think I got them. Sorry for
>>>> my "What else would you expect" comment, that was a failed attempt of
>>>> being funny.
>>>>
>>>> I don't have LibreOffice installed, I don't know if the others do. So
>>>> the best would be that you create a PDF where the borders are obvious,
>>>> and upload it somewhere.
>>>>
>>>> Tilman
>>>>
>>>>
>>>>
>>>> Am 28.06.2015 um 17:33 schrieb Александр Свиридов:
>>>>> Воскресенье, 28 июня 2015, 17:10 +02:00 от Tilman Hausherr
<  THausherr@t-online.de >:
>>>>>> Am 28.06.2015 um 16:43 schrieb Александр Свиридов:
>>>>>>>      When I print pdf document it doesn't stretch to take normal
A4 page area. I mean that margins are too big and document is smaller then it could be and
is located in center of the page.
>>>>>> Yes it is centered. What else would you expect? Adjusted to the bottom
>>>>>> right? I don't understand you. Really. Of course I expect it to be
centered. And it is centered as it's expected. However, If everything were as expected I wouldn't
right to mailing list, would I?
>>>>> I always thought that information for fixing some bug is a starting point.
That's why I provided this information.
>>>>>> We'd need the PDF to find out what (if anything) is wrong I do all
files using Libre Office. I tried different files and even very simple ones. So just take
any file and you must get the same results.
>>>>>>
>>>>>>
>>>>>> Please try also printing it with Adobe Reader in 100% mode. I printed
my pdf file with Adobe Reader in mode 100%. And as expected left and right margins are about
2cm. In comparison when I print using pdfbox left margin is 4.5cm, right about 3.5cm.
>>>>>>
>>>>>> Tilman
>>>>>>
>>>>>> PS: don't CC user postings to me. I get then anyway. Really sorry
for this. I can't understand why my mailing service added your address and I didn't notice
it.
>>>>> So the problem is still there. How to fix it?
>>>>>>> My code:
>>>>>>> PrinterJob job = PrinterJob.getPrinterJob();
>>>>>>> Paper paper=new Paper();
>>>>>>> paper.setSize(72d*8.267d, 72d*11.692);
>>>>>>> PDFPrinter pDFPrinter=new PDFPrinter(document,Scaling.SCALE_TO_FIT,
Orientation.PORTRAIT,paper);
>>>>>>> pDFPrinter.silentPrint(job);
>>>>>>>
>>>>>>> Please help me to solve this problem.
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>>>>>> For additional commands, e-mail:  users-help@pdfbox.apache.org
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail:  users-help@pdfbox.apache.org
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:  users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail:  users-help@pdfbox.apache.org
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message