Are the missing words in a different font? Or positioned unusually? The rendering / printing functionality is still very much under development. There are SO many options that PDF supports, that we still see PDF documents that we're not rendering / printing correctly.
dwilson 2009/3/31 Victor José Bento <[email protected]> > Thanks Daniel, commenting all the code of the constructor my applet worked, > but when I see the final printed document I realized that some words that > were in the document disappeared. You know what may be happening? > > Thanks, > > Victor José Bento > Software Developer | DIGITALMED > Mobile +55 11 7638 4171 > > > On Mon, Mar 30, 2009 at 9:22 PM, Daniel Wilson < > [email protected]> wrote: > > > The logging is in > > trunk\src\main\java\org\apache\pdfbox\exceptions\LoggingObject.java. See > > line 38 for the file path. > > > > To disable it, I would comment out the entire constructor -- lines 37 - > 58. > > > > Daniel Wilson > > > > 2009/3/30 Victor José Bento <[email protected]> > > > > > Thanks for your help Andreas. Can you show me how to deactive the > logging > > > for the applet or like you said, change the path of the logfile? > > > > > > Thanks, > > > > > > Victor José Bento > > > Software Developer | DIGITALMED > > > Mobile +55 11 7638 4171 > > > > > > > > > 2009/3/30 Andreas Lehmkühler <[email protected]> > > > > > > > It might be a security problem with the applet sandbox. Your > stacktrace > > > > shows an IOException at the end. It is thrown during locking the > > logfile. > > > As > > > > the access to local files should be limited in the applet-sandbox it > > will > > > > perhaps help to deactive the logging for the applet or to change the > > path > > > of > > > > the logfile to a local applet-dir with write access? > > > > > > > > Andreas Lehmkühler > > > > > > > > ----- original Nachricht -------- > > > > > > > > Betreff: silentPrint method > > > > Gesendet: Fr, 27. Mrz 2009 > > > > Von: Victor José Bento<[email protected]> > > > > > > > > > Hi. I'm trying to create an applet to use the method silentPrint, > the > > > > > applet works when I run it on NetBeans, but when I try to load it > on > > my > > > > > webpage (yes I signed all jar files) I can just print my PDF files > to > > a > > > > > printer that generate tiff files (Microsoft Office Document Image > > > > Writer), > > > > > I > > > > > can't use the Samsung SCX-4x21 Series, that works when I run the > > applet > > > > on > > > > > NetBeans. Using silentPrint() or print() from my webpage I get the > > > > > following > > > > > exception, someone can help me? > > > > > > > > > > java.awt.print.PrinterIOException > > > > > at org.apache.pdfbox.pdmodel.PDPage.print(PDPage.java:768) > > > > > at sun.print.RasterPrinterJob.printPage(Unknown Source) > > > > > at sun.print.RasterPrinterJob.print(Unknown Source) > > > > > at sun.print.RasterPrinterJob.print(Unknown Source) > > > > > at > > > org.apache.pdfbox.pdmodel.PDDocument.silentPrint(PDDocument.java:886) > > > > > at DMApplet$1.run(DMApplet.java:53) > > > > > at DMApplet$1.run(DMApplet.java:23) > > > > > at java.security.AccessController.doPrivileged(Native Method) > > > > > at DMApplet.Print(DMApplet.java:22) > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > > > > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > > > > > at java.lang.reflect.Method.invoke(Unknown Source) > > > > > at sun.plugin.javascript.JSInvoke.invoke(Unknown Source) > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > > > > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > > > > > at java.lang.reflect.Method.invoke(Unknown Source) > > > > > at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source) > > > > > at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown > > Source) > > > > > at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown > > > Source) > > > > > at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source) > > > > > at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source) > > > > > at > > > > > > > > > > > > > > > sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDe > > > > > legate.invoke(Unknown > > > > > Source) > > > > > at > > > > > sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown > > > > > Source) > > > > > at java.security.AccessController.doPrivileged(Native Method) > > > > > at > > > > > > > > > > > > > > > sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown > > > > > Source) > > > > > at > > > > > > > > > > > > > > > sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.r > > > > > un(Unknown > > > > > Source) > > > > > at java.lang.Thread.run(Unknown Source) > > > > > Caused by: java.io.IOException: Couldn't get lock for PDFBox.log > > > > > at java.util.logging.FileHandler.openFiles(Unknown Source) > > > > > at java.util.logging.FileHandler.<init>(Unknown Source) > > > > > at > > > > > > > > > org.apache.pdfbox.exceptions.LoggingObject.logger(LoggingObject.java:38) > > > > > at > > > > > > > > > > > > > > > org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java > > > > > :221) > > > > > at > > > > > > > > > > > > > > > org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:17 > > > > > 3) > > > > > at > > org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:88) > > > > > at org.apache.pdfbox.pdmodel.PDPage.print(PDPage.java:764) > > > > > ... 28 more > > > > > Now my method: > > > > > > > > > > public static String Print(final String printerName, final String > > > > > urlDocument) > > > > > { > > > > > String retornoFinal = ""; > > > > > retornoFinal = (String)AccessController.doPrivileged(new > > > > > PrivilegedAction<String>() > > > > > { > > > > > public String run() > > > > > { > > > > > String retorno = ""; > > > > > boolean erro = true; > > > > > PDDocument impressao = null; > > > > > try > > > > > { > > > > > PrintService impressoras[] = > > > > > PrintServiceLookup.lookupPrintServices(null, null); > > > > > PrinterJob printerJob = > > PrinterJob.getPrinterJob(); > > > > > impressao = PDDocument.load(new > > > > > URL(urlDocument).openStream()); > > > > > for(int i = 0; i < impressoras.length; i++) > > > > > { > > > > > if > > > > > (impressoras[i].getName().equalsIgnoreCase(printerName.trim())) > > > > > { > > > > > > > printerJob.setPrintService(impressoras[i]); > > > > > erro = false; > > > > > break; > > > > > } > > > > > } > > > > > if (erro) > > > > > { > > > > > retorno += "Não foi possível encontrar a > > > > impressora > > > > > " + printerName.trim(); > > > > > } > > > > > else > > > > > { > > > > > impressao.silentPrint(printerJob); > > > > > } > > > > > } > > > > > catch (Exception ex) > > > > > { > > > > > ex.printStackTrace(); > > > > > } > > > > > finally > > > > > { > > > > > try { > > > > > impressao.close(); > > > > > } catch (IOException ex) { > > > > > > > > > > Logger.getLogger(DMApplet.class.getName()).log(Level.SEVERE, null, > > ex); > > > > > } > > > > > } > > > > > return retorno; > > > > > } > > > > > }); > > > > > return retornoFinal; > > > > > } > > > > > > > > > > Thanks! > > > > > > > > > > Victor José Bento > > > > > Software Developer | DIGITALMED > > > > > Mobile +55 11 7638 4171 > > > > > > > > > > > > > --- original Nachricht Ende ---- > > > > > > > > > > > > > >
