pdf-php icon indicating copy to clipboard operation
pdf-php copied to clipboard

addPDFFromFile

Open MonteShaffer opened this issue 8 years ago • 6 comments

Hi, I contributed to the angle rotation on get hub for PNG files. It appears you have extended this to include JPG, but I don't know about GIFs?

This note is to ask about the ability to import a PDF object into a R&OS object. I can do this in Latex no problem... Similar to embedding images (PNG, GIF, JPG), I want to embed a PDF ... and probably with "clip options" - below is the syntax for latex...

\includegraphics[trim = 0 0 0 0,clip,width=6.5in]{pdfs/sample_growth.pdf}

MonteShaffer avatar Dec 24 '16 19:12 MonteShaffer

@MonteShaffer not quite sure yet but I guess gif will be converted into png. So I assume everything that is possible with png should also be possible with gif?!

ole1986 avatar Jan 05 '17 20:01 ole1986

We are going to work on this, and provide a function if we can solve the problem.

PDFs are a collection of objects... and a PDF object could exist in the master PDF object. This is something I use all of the time with latex ...

PNG / GIF / JPEG are expensive since they have to load all the binary data in. A PDF object is not very expensive because it may contain vectorized data.

Specifically, I can export a HighCharts graph as a PNG or PDF. The file size is 48KB and 17KB respectively for a test case. Building in Latex, the with a reduced-size image, the file size is 45KB and 29KB respectively. So it can be done. If I were to bump up the PNG size, the entire file size would keep getting bigger, but the PDF version will remain pretty much unchanged (if the PDF has vectorized elements).

Anyway, we will play around and see if we can come up with a function ... addPdfFromFile

IMAGES basic.pdf basic

LATEX-BUILDS hello-pdf.pdf hello-png.pdf

ROS BUILDS hello-pdf.pdf hello-png.pdf

Currently ROS build for hello-pdf.pdf fails since it doesn't have a way to read the stream in correctly... If you want to take a stab at this, please let me know.

MonteShaffer avatar Jan 06 '17 21:01 MonteShaffer

http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference13.pdf

The 1.3 specification is above...

Latex is running on the 1.5 spec ... Below is the Latex code, and /PTEX.FileName (./graphs/basic.pdf) is not a 1.3 command ...

So can we push development forward to be at least 1.5 compliant ...

http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference15_v5.pdf

I don't see PTEX here either... In latex I am using the graphicx package ... maybe this is a psuedo tag it generates...

Honestly, I would like to see a push to at least 1.7 compliant... as I believe it has "annotation" features...

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf

http://www.adobe.com/devnet/pdf/pdf_reference.html


1 0 obj
<<
/Type /XObject
/Subtype /Form
/FormType 1
/PTEX.FileName (./graphs/basic.pdf)
/PTEX.PageNumber 1
/PTEX.InfoDict 9 0 R
/BBox [0 0 1200 800]
/Resources <<
/ColorSpace <<
/PCSp 10 0 R
/CSp /DeviceRGB
/CSpg /DeviceGray
>>/ExtGState <<
/GSa 11 0 R
>>/Pattern <<
>>/Font << /F7 12 0 R/F8 13 0 R>>
/XObject <<
>>>>
/Length 1414
/Filter /FlateDecode
>>
stream
xœíZÝ‹ã6÷_¡çB²úþ€rp›î
-,	ÜCéCÉqWŽìÑpý÷;#ÉÉø#Y;qb/8!±4ÖÈ3úI£™‘~]ÿ;þ`«õ¿l›¯«u!‡ï/žs¶}-öl_¼/ð×}Qrðøý±ý^<¤¾ŠDY¯þ€^þc’ý¿ßòýù\>çn°Ñk!$ÇÂ.ðY»âxÅÿŠO?±ï#<ñ¾î¥ð+{+ÙEüÖÙ»éõe`¹ø2p,w^³S咝»®²Ë”tKÃñ*˜À)aW¬ÇNz^ŽÆN©špGÂèÂ	_ƒ•ÆN×`%„Ñ…%ˆ¥p„0ºpÚÔ„#„«…ó<@ ¯‚Æz‹Â¥’tç„>”‚AsHʍ,’²*%Œ.6¶*%Œ.L³ªt”0¾tǐ¥#„ñ¥»é‹¾ÄœJ	7ðª¤aZŠ+}ŠëRÕÛË´ãRôŽNIÓ³Ë.íQ~Ðä Åþâ‡>nŠ‡gǤf›/Œ¸íœm^‹Ò¦qTÐ)¶ùÌ~†ŠøÀ6ß
¡±Q¢ÈEEŠ=tjbŽÓ`²‘ò´A‡»Ú}Ç·ó\hL£¡ýëÛ‡BH$rϱ´K%kt,JRŠw/F!¥šùƵ»F£¡

endstream
endobj

MonteShaffer avatar Jan 06 '17 21:01 MonteShaffer

honestly I would prefer to use the experimental for this, as this already supports import PDF feature.

ole1986 avatar Jan 09 '17 19:01 ole1986

ok. is "experimental" basically functional? I see "annotations", but I don't see "import PDF"...

MonteShaffer avatar Jan 09 '17 20:01 MonteShaffer

There is a class CpfPdi available for import... But you know it's experimental...

ole1986 avatar May 21 '17 05:05 ole1986