ShaigMammadov / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

appendPDF() doesn't work on remote servers though works fine locally. #95

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
jZebra Version: 1.4.5
Server OS: Debian 5
Client OS: Windows 7 Professional SP1
Client Browser: Firefox 16
Printer: HP LaserJet P2035

Okay I have created this JS function:

====================================

function printPdf() {
    var jz = document.jzebra;
    jz.setPrinter(3); // This is the printer "ID" for the HP printer.
    jz.appendPDF('https://mydomain.com/path/to/pdf');
    while(!jz.isDoneAppending()) {
        // Do nothing - it looks like I don't need this, though. It works fine without it.
    }
    jz.printPS();
}

====================================

This function works as expected locally - set the printer to the HP pritner, 
fetch a PDF content on a remote server, and print out.
However, once I upload this to a remote server and access via HTTP, this just 
stops working.

I looked at the getException() but it was null all the way, there is no JS 
error reported by the browser, and other jZebra functions like print() works 
fine on the same server - in fact, I was even able to print out PostScriptImage 
example from the sample.html on this remote server, and that indicates that the 
problem is with appendPDF(), because this function is the only difference from 
the PSImage example.

I tried various PDF files to fetch, too - http or https, php-generated or a 
static file, as well as several remote servers, but none worked remotely, 
although everything worked fine locally...

Can someone please help me with this...?  I can't go home tonight unless I get 
this working... :(

Thank you very much!

Brandon

Original issue reported on code.google.com by sho...@gmail.com on 13 Oct 2012 at 2:25

GoogleCodeExporter commented 8 years ago
Can you send me via email an example using a remote pdf you have hosted?  I 
will try to replicate.

tres.finocchiaro@gmail.com

-Tres

Original comment by tres.fin...@gmail.com on 13 Oct 2012 at 3:16

GoogleCodeExporter commented 8 years ago
Hello,

Thank you so much for your quick reply.  Just sent you an email with the sample 
file attached.

Thank you!!

Brandon

Original comment by sho...@genetrack.com on 13 Oct 2012 at 3:53

GoogleCodeExporter commented 8 years ago
I've used the 3 provided PDF samples and was unable to reproduce the error.

Attached are the 3 html files and the 3 output XPS files.

My best guess is the problem lies in the logic that waits for the append to be 
finished.  If the file hasn't appended yet, it will try to print an empty 
document.  This append takes longer on remote sites for obvious reasons. 

Also, there's some better ways to do this than those illustrated in 
sample.html, I would recommend starting from loading.html and going from there.

-Tres

Original comment by tres.fin...@gmail.com on 13 Oct 2012 at 1:40

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Tres,

Thank you for looking into this, and I am sorry about the late reply.
After getting your response, I rewrote the script and run it again on different 
remote servers, and they all worked except for the production server where this 
printing feature is most needed.

The weird thing is that the same script runs just fine on another remote 
server.  I literally moved over the script to the production server, and it 
just stops working.

I tracked down the process and it looks like appending and printing are 
completed without errors, but the printer won't print it.  I am suspecting 
that, somehow, on the production server, the PDF fiels are not really appended, 
although there seem to be, according to the logs.

Is there any way to see if there is anything (any PDF content) appended to 
jZebra instance?  All I need is to be able to confirm that the content was 
indeed appended.

Thank you,

Brandon

Original comment by sho...@genetrack.com on 16 Oct 2012 at 6:24

GoogleCodeExporter commented 8 years ago
One more thing, the printer I have been using was able to print out the PDF 
from the script on other remote servers.  Even with the production site, I can 
still select it and print out some RAW input.  PDF printing is the only thing 
that's not working on the production server..

Original comment by sho...@genetrack.com on 16 Oct 2012 at 6:26

GoogleCodeExporter commented 8 years ago
It seems you have narrowed the cause to be related to the configuration on your 
production server.  Without access to the server, there's not much more 
troubleshooting that can be done from an outside perspective.

I would recommend trying to use a command such as wget from a Linux machine 
with the URL of the production PDF. It is very likely that the path to the PDF 
on your production machine has some permissions or settings set up incorrectly.

-Tres

Original comment by tres.fin...@gmail.com on 16 Oct 2012 at 6:35