You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2018/07/10 16:39:00 UTC

[jira] [Commented] (PDFBOX-4264) PDDocument.load(fileToPrint) doesn't work when execute as windows service

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

Tilman Hausherr commented on PDFBOX-4264:
-----------------------------------------

Please try with the 2.0 version. Also tell whether the problem happens with any PDF file.

> PDDocument.load(fileToPrint) doesn't work when execute as windows service
> -------------------------------------------------------------------------
>
>                 Key: PDFBOX-4264
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4264
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 1.8.15
>         Environment: Windows 7 Pro 64 bits.
> JDK 1.7.0_51
>            Reporter: Juan Manuel
>            Priority: Blocker
>         Attachments: 119724.pdf
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
>  
> I have the following code that works perfect when I run the program from any user. The problem arises when he tried to execute it as a windows service. This service is configured to be executed with the same user with whom I am logged in. How is a windows service, I can not make outputs, so I resorted to register in my text files the activity of my program. And everything works until you have to execute the line: PDDocument.load After this line the program does not continue and does not issue execpciones to capture. The JDK that I use is 1.7.0._51.
> I have tried with the latest version of PDBOX and it has not fixed.
> I have verified execution, reading and modification permissions. Tested with absolute paths. Anyway, everything.
> Thanks for your interest.
> regards
> {code:java}
> File fileToPrint = new File(rutaNombreArchivo);
> PDDocument load = PDDocument.load(fileToPrint.toString());
> // PDDocument load = PDDocument.loadNonSeq(fileToPrint,null);
> try {
>  
>   final PrinterJob printJob = PrinterJob.getPrinterJob();
>   printJob.setPrintService(services[selectedService]);
>   printJob.setJobName(fileToPrint.getName());
>   final HashPrintRequestAttributeSet printRequestAttributes = new     HashPrintRequestAttributeSet();
>   printJob.print(printRequestAttributes);
>   for (int i = 1; i <= cantVia; i++) {
>     load.silentPrint(printJob);
>   }
> } catch (final PrinterException e) {
>   Log.addLog(Log.tipoMensaje.ErrorGenerico, e.getMessage());
> // e.printStackTrace();
> } finally {
>   if (load != null) {
>     load.close();
> }
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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