The problem is that I'm POSTing some data to the PHP file, the post data are some parameters in from which the PDF will generate, I'd do it with an anchor or a normal form, but I'm posting complex data which JavaScript is helping me with.
I used console.log(data)
on my success function of the JQuery .ajax method, and it prints the following.
HTTP/1.0 200 OK
Cache-Control: no-cache, private
Content-Disposition: inline; filename="document.pdf"
Content-Type: application/pdf
Date: Fri, 03 Aug 2018 14:48:08 GMT
%PDF-1.3
1 0 obj
<< /Type /Catalog
/Outlines 2 0 R
/Pages 3 0 R >>
endobj
2 0 obj
<< /Type /Outlines /Count 0 >>
endobj
3 0 obj
<< /Type /Pages
/Kids [6 0 R
]
/Count 1
/Resources <<
/ProcSet 4 0 R
/Font <<
/F1 8 0 R
/F2 9 0 R
>>
/ExtGState <<
/GS1 10 0 R
/GS2 11 0 R
/GS3 12 0 R
/GS4 13 0 R
>>
>>
/MediaBox [0.000 0.000 595.280 841.890]
>>
endobj
4 0 obj
[/PDF /Text ]
endobj
5 0 obj
<<
/Producer (�� d o m p d f)
/CreationDate (D:20180803104808-04'00')
/ModDate (D:20180803104808-04'00')
>>
endobj
6 0 obj
<< /Type /Page
/MediaBox [0.000 0.000 595.280 841.890]
/Parent 3 0 R
/Contents 7 0 R
>>
endobj
7 0 obj
<< /Filter /FlateDecode
/Length 673 >>
stream
...lots of stream chars goes here...
endstream
endobj
8 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F1
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
>>
endobj
9 0 obj
<< /Type /Font
/Subtype /Type1
/Name /F2
/BaseFont /Helvetica-Bold
/Encoding /WinAnsiEncoding
>>
endobj
10 0 obj
<< /Type /ExtGState
/BM /Normal
/ca 0.67
>>
endobj
11 0 obj
<<
/Type /ExtGState
/BM /Normal
/CA 0.67
>>
endobj
12 0 obj
<< /Type /ExtGState
/BM /Normal
/ca 1
>>
endobj
13 0
obj
<< /Type /ExtGState
/BM /Normal
/CA 1
>>
endobj
xref
0 14
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n
0000000350 00000 n
0000000379 00000 n
0000000538 00000 n
0000000641 00000 n
0000001386 00000 n
0000001493 00000 n
0000001605 00000 n
0000001665 00000 n
0000001725 00000 n
0000001782 00000 n
trailer
<<
/Size 14
/Root 1 0 R
/Info 5 0 R
/ID[<f9dc912e3da657434ee0495c45e20e3a><f9dc912e3da657434ee0495c45e20e3a>]
>>
startxref
1839
%%EOF
I'm sending the data to the client with a response, and I want to open a new tab-pop-up window with the PDF generated, but window.open() isn't doing the trick.