Question

I'm having a issue with my JavaScript, I'm working with a web Service (not mine), which retrieves a file content in plain text (for what I read it's binary data, although I receive it like a string). This webService works great with files like .txt, but with PDFs, DOCXs and any other "complex" file, it doesn't crash, but the downloaded file is corrupted. First i thought it was the service, but after a few test I realize it was javascript.

Here is a fiddle with the code I'm testing, although it doesn't work on fiddle (I don't know why) if you create a simple html file and paste the code in a script tag, you'll see the pdf is generated, with all the pages, but empty. The responseText starts with something like.

%PDF-1.2
6 0 obj
<< /S /GoTo /D (chapter.1) >>
endobj
8 0 obj
(Template)
endobj
10 0 obj
<< /S /GoTo /D (section.1.1) >>
endobj
12 0 obj
(How to compile a texttt {.tex} file to a texttt {.pdf} file)
endobj
14 0 obj

I was wondering if there is any function/method to fix this. For what i heard, its a problem with some special chars, like '\0'

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top