I am currently making my own API for a PDF creation tool, using the ISO SPEC, from scratch. The intent is to create some PDF by code. So far it is going good. I can create pages, text, boxes,… the last thing I need to implement is the possibility to add some images. Here is what I’ve got so far :
%PDF-1.7
1 0 obj << /Type /Catalog /Pages 2 0 R >> endobj
2 0 obj << /Type /Pages /Kids [ 4 0 R ] /Count 1 >> endobj
3 0 obj << /Length 37 >> stream
q 403 0 0 115 36 200 cm /Im1 Do Q
endstream endobj
4 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 3 0 R /Resources << /XObject << /Im1 5 0 R >> >> >> endobj
5 0 obj << /ColorSpace /DeviceRGB /Height 115 /Subtype /Image /Type /XObject /Width 403 /BitsPerComponent 8 /Length 14079 >>
stream
….[image stream]….
endstream endobj
xref
0 6
0000000000 65535 f
0000000010 00000 n
0000000060 00000 n
0000000120 00000 n
0000000206 00000 n
0000000337 00000 n
trailer
<< /Size 6 /Root 1 0 R >>
startxref
14567
%%EOF
After inspecting some existing PDF documents, I’m pretty sure this is close to working. However, AcrobatReader won’t open my document, and opening it with Edge displays the document, but the image is funcky.
For the stream itself I use :
Dim byteStream As Byte() = IO.File.ReadAllBytes("C:Users---------------Imagestest.JFIF")
Clearly I’m missing something here. Has somebody any hint ?
Thank you & kind regards,
FINET L.
SPEC, Internet, Forums, ..
user24642980 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.