pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: Beginner's question....
Date Wed, 10 Jun 2015 17:21:13 GMT
You can ignore those messages, they’re just letting you know that the PDF
contains some accessibility features which PDFBox is ignoring. That won’t
have any affect on printing.

PDFBox 1.8 has some printing issues which were never resolved, I’d
recommend trying 2.0, which has a new printing API and may bug fixes.

— John

> On 10 Jun 2015, at 00:53, thierry.mathey@havells-sylvania.com wrote:
> 
> Hello,
> 
> I send the below mail again, because attachments were too big and the email could not
be delivered.
> The attachments can be found here :
> https://onedrive.live.com/redir?resid=DE74897F93E86D64!3143&authkey=!AJ4JjSYbNleABUI&ithint=folder%2c
<https://onedrive.live.com/redir?resid=DE74897F93E86D64!3143&authkey=!AJ4JjSYbNleABUI&ithint=folder%2c>
> 
> Cordialement / Best regards
> 
> 
> Thierry MATHEY
> IT EDI Expert
> Havells-Sylvania
> 
> thierry.mathey@havells-sylvania.com
> 
> T +33 (0)1 55 51 11 64
> M +33 (0)6 71 01 87 06
> 
> 
> Thierry Mathey---10/06/2015 09:09:36---Hello, Thanks a lot for your answer.
> 
> From:	Thierry Mathey/Gennevilliers/SLIMAIL
> To:	users@pdfbox.apache.org
> Cc:	Gael Duret/Plessis/SLIMAIL@SLIMAIL
> Date:	10/06/2015 09:09
> Subject:	Re: Beginner's question....
> 
> 
> Hello,
> 
> Thanks a lot for your answer.
> 
> Indeed, I have used "flavor" with another trying, but it's not used anymore.
> 
> I'm now using :
> 
> PrinterJob job = PrinterJob.getPrinterJob();
> job.setPageable(new PDPageable(doc));
> job.print(aset);
> 
> with the attached PDF (which should be in duplex A3 format)... PDF file = 352010...
> 
> I have added MediaSizeName.ISO_A3 to aset, and also Sides.TWO_SIDED_LONG_EDGE .
> But I got the result in A4, no duplex print, the printing is larger than the paper size
and the text is not printed (only images)...
> I received these messages :
> juin 10, 2015 9:00:20 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: i
> juin 10, 2015 9:00:21 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: i
> juin 10, 2015 9:00:22 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: i
> juin 10, 2015 9:00:23 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: i
> 
> When I try with another PDF (A4, no duplex print), it's printing the right way. PDF file
= 352011...
> But, I received these messages :
> juin 10, 2015 9:01:08 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: BDC
> juin 10, 2015 9:01:08 AM org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
> INFOS: Using font SansSerif.plain instead of FrutigerLTStd-BlackCn
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
> INFOS: Using font SansSerif.plain instead of FrutigerLTStd-Light
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: MP
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: EMC
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: BDC
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
> INFOS: Using font SansSerif.plain instead of FrutigerLTStd-BlackCn
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.pdmodel.font.PDType0Font getawtFont
> INFOS: Using font SansSerif.plain instead of FrutigerLTStd-Light
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: MP
> juin 10, 2015 9:01:09 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
> INFOS: unsupported/disabled operation: EMC
> 
> 
> Cordialement / Best regards
> 
> [attachment "352010 IS1889 HSX Sylline A3RV.pdf" deleted by Thierry Mathey/Gennevilliers/SLIMAIL]
[attachment "352011 IS1899 SLIMRANA SUSPENDU A4R.pdf" deleted by Thierry Mathey/Gennevilliers/SLIMAIL]

> Thierry MATHEY
> IT EDI Expert
> Havells-Sylvania
> 
> thierry.mathey@havells-sylvania.com
> 
> T +33 (0)1 55 51 11 64
> M +33 (0)6 71 01 87 06
> 
> 
> 
> John Hewson ---09/06/2015 21:08:58---Hi, > On 9 Jun 2015, at 01:45, thierry.mathey@havells-sylvania.com
wrote:
> 
> From:	John Hewson <john@jahewson.com>
> To:	users@pdfbox.apache.org
> Date:	09/06/2015 21:08
> Subject:	Re: Beginner's question....
> 
> 
> 
> Hi,
> 
> > On 9 Jun 2015, at 01:45, thierry.mathey@havells-sylvania.com wrote:
> > 
> > Hello,
> > 
> > I'm a french beginner either in Java and using PDFBox...
> > 
> > I want to use PDFBox to print PDF files stored on a disk.
> > No problem to get the PDF from disk, but my problem is to print the PDF
> > file with correct attributes...
> > 
> > I have "simple" PDF files (format A4, portrait, no duplex print), but I
> > have also other attributes (A3 and/or Landscape and/or duplex) that can
> > change.
> > And I want a complete Silent print…
> 
> This is possible.
> 
> > I've tried with this class, but this doesn't work :
> > 
> > public class PDFmanager {
> > private String filename;
> > private String size;
> > //private String orientation;
> > private Integer copies;
> > private PrintService printer;
> > private PrintRequestAttributeSet aset;
> > private DocAttributeSet asetD;
> > private DocFlavor flavor;
> > 
> > public PDFmanager(String size, boolean duplex) {
> > super();
> > flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
> > PrintRequestAttributeSet aset = new
> > HashPrintRequestAttributeSet();
> > 
> > if (size == "A4"){
> > aset.add(MediaSizeName.ISO_A4);
> > ;
> > } else if (size == "A3"){
> > aset.add(MediaSizeName.ISO_A3);
> > 
> > }
> > if (duplex){
> > aset.add(Sides.TWO_SIDED_LONG_EDGE);
> > 
> > } else {
> > aset.add(Sides.ONE_SIDED);
> > 
> > }
> > 
> > PrintService[] pservices =
> > PrintServiceLookup.lookupPrintServices(null, null);
> > 
> > 
> > if (pservices.length > 0) {
> >    for (PrintService selprinter : pservices) {
> >         System.out.println("Printer: " + selprinter.getName()+"
> > Attr : "+ selprinter.getAttributes().toString());
> >         /* TODO : modifier MYPRINTER par nom imprimante STE */
> >         if (selprinter.getName().equals("\\\\svgendc01
> > \\PNGEN0029")) {
> >                 printer = selprinter;
> >         }
> >    }
> > }
> > }
> > 
> > 
> > public void printPDF() throws IOException, PrinterException {
> > 
> >     if (!(printer == null)) {
> > PrinterJob job = PrinterJob.getPrinterJob();
> >     job.setCopies(copies);
> > 
> >     job.setPrintService(printer);
> >     PDDocument doc = PDDocument.load(filename);
> >     doc.silentPrint(job);
> >     //doc.print();
> >     doc.close();
> >     } else {
> >     JOptionPane.showMessageDialog(null,
> >                 "Pas d'imprimante valide pour l'impression des
> > Notices !",
> >                 "Erreur",
> >                 JOptionPane.WARNING_MESSAGE);
> >     }
> > }
> > 
> > 
> > 
> > public String getFilename() {
> > return filename;
> > }
> > 
> > public void setFilename(String filename) {
> > this.filename = filename;
> > }
> > 
> > public String getSize() {
> > return size;
> > }
> > 
> > public void setSize(String size) {
> > this.size = size;
> > }
> > 
> > public Integer getCopies() {
> > return copies;
> > }
> > 
> > public void setCopies(Integer copies) {
> > this.copies = copies;
> > }
> > 
> > public PrintService getPrinter() {
> > return printer;
> > }
> > 
> > public void setPrinter(PrintService printer) {
> > this.printer = printer;
> > }
> > 
> > }
> > 
> > I use  INPUT_STREAM.AUTOSENSE   because  INPUT_STREAM.PDF  doesn't work...
> > And the printer I select can print with any of selected attributes (Kyocera
> > FS-C8100DN).
> 
> You’re not using Java's printing API correctly. An INPUT_STREAM DocFlavor is for
> client formatted print data and cannot be used with Printable / Pageable which are
> for use with service formatted print data.
> 
> See: http://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm2.html
<http://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm2.html>
<http://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm2.html <http://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm2.html>>
> And: https://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm1.html
<https://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm1.html>
<https://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm1.html <https://docs.oracle.com/javase/8/docs/technotes/guides/jps/spec/printing2d.fm1.html>>
> 
> However, you never do anything with the “flavor” variable anyway.
> 
> > The attributes were used to select the Printer Service, but no printer was
> > selected when I did this. Now, they are not used…
> 
> Actually the attributes are never used in your code.
> 
> > But, the printing is not correct (no A3, content not adjusted to page
> > format...).
> > Is it possible to set attributes at the moment I start the print ?
> 
> You've created a PrintRequestAttributeSet however you never do anything
> with it. You can pass it to the PrinterJob as follows:
> 
> PrinterJob job = PrinterJob.getPrinterJob();
> job.setPageable(new PDPageable(doc));
> job.print(aset);
> 
> — John
> 
> > 
> > Maybe I'm not using PDFBox the right way....
> > 
> > What can I do ?
> > 
> > Cordialement / Best regards
> > 
> > 
> > Thierry MATHEY
> > IT EDI Expert
> > Havells-Sylvania
> > 
> > thierry.mathey@havells-sylvania.com
> > 
> > T +33 (0)1 55 51 11 64
> > M +33 (0)6 71 01 87 06
> > This e-mail and any attachments may contain confidential and privileged information.
If you are not the intended recipient, please notify the sender immediately by return e-mail,
delete this e-mail and destroy any copies. Any dissemination or use of this information by
a person other than the intended recipient is prohibited and may be unlawful.
> 
> 
> www.havells-sylvania.com <http://www.havells-sylvania.com/>
> 
> 
> 
> This e-mail and any attachments may contain confidential and privileged
> information. If you are not the intended recipient, please notify the sender
> immediately by return e-mail, delete this e-mail and destroy any copies.
> Any dissemination or use of this information by a person other than the
> intended recipient is prohibited and may be unlawful.
> 
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message