Repeat Image in fpdf without creating another instance - fpdf

I know in PDFs one can have an image repeated (appear in the PDF more than once) without having multiple instance of the image (i.e. the image data appears in the file only once).
Is there a way to do this with fPDF? I am generating a PDF containing sheets of cards; each has artwork. The artwork, which can be 300dpi, may appear in the file thousands of times.

FPDF will only embed the image once.
From http://www.fpdf.org/en/doc/image.htm
Remark: if an image is used several times, only one copy is embedded in the file.

fPDF does this always. It checks to see if the filename has been added already and creates a reference to the original rather than re-add the image data.
I had used a report designer where this kind of reference had to be made explicitly and I erroneously expected fPDF would work similarly.

Related

replace images and rebuild all rendered images

I've a Image (logo.jpg 800x800) uploaded in the Backend of typo3. This image is used in many different articles. I've placed the image in these articles in many different sizes, sometimes 400x400, 200x200, etc..
So typo has rendered the smaller version of the original 800x800 logo.jpg.
Now I've to replace the logo with a newer version. I thought I can use the function "replace file" in the media backend from typo3. So i used this function and replaced the logo. Now the new file logo.jpg is in the backend, but all articles show the old version.
My question is, is there another way to replace a previously used image? Or is there a way to "restart" the rendering process in typo3 for all images. It looks like, the smaller version of the image are still in the cache or something like that. But clearing the cache doesn't help.
It depends on your TYPO3 version.
prior to 6.0 (and without extension 'dam') each file was copied on each
usage. so if you have used an image 40 times this image exists in 40
copies on your server. and any change to the original (modify/delete)
would change nothing to these copies.
from these copies calculated versions are build. so further 40 images
could be stored on your server.
the copies are stored, depending on the field they are used in, beyond
/uploads/...
possible places: /uploads/pics/ /uploads/tx_myext/
the calculated images are stored beyond typo3temp.
to replace one image you need to: remove all calculated versions.
and replace all copies with the changed image.
with 6.0 FAL was introduced and images/files were not copied any longer,
but referenzes are stored. Also calculated images are stored by hash so
a resized image can be reused instead of reclculated,
It's just a problem that FAL is not working completely satisfying and a
lot of work is done to fix this for 6.2. After that a change of an file
may result in changes in every usage.

StackOverFlowException while trying to generate multiple PDFs using iTextSharp

I'm using iTextSharp to generate PDF files from a console application. And I wanted to add a footer to the PDF report. Hence as suggested, I have created a Footer class which inherits PdfPageEventHelper class and overiding the OnEndPage event. Then I have the assigned the instance of this footer class to the PageEvent of my Writer object. Now everything works fine and the PDF file is getting generated.
But I face the problem when I want to generate multiple PDF files in a loop. When I try to create PDF files in a loop, I'm getting StackOverFlowException in the onEndPage event after generating few files. Any suggestions to get rid of this exception? Thanks in Advance.
Regards,
Muthiah

Dynamic controls in PDF Adobe Cycle

Does anyone know how to add control (example: field) on-run in PDF? I'm using Adobe LiveCycle ES2; need that piece of JavaScript....
Thank you all -
I previously tried to do something similar but have never been able to find a method of dynamically creating an object on a form.
You can use the addInstance command to add an instance of a new form and it's possible to add additional rows to a table but other than that, the only method I have found that works is to add the objects from the toolbox and then show/hide them.
It does mean that you're adding additional objects to the form but if used correctly this doesn't really have too much affect on the file size but it does involve extra coding.

iPhone sdk how to retrieve the Table of Contents from PDF file?

I am using VFR reader to display my pdf's. I need to extract the Table of Contents on a button click and display it in a tableview then it should lead to the respective pages while tapping on each.I googled for this and got these links
Create a table of contents from a pdf file
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-adding-a-table-of-contents-to-an-ipad-reader/
And i came to know that, to get TOC we must use "CGPDFDocumentGetCatalog(pdf doc)". But in my reader that "CGPDFDocumentGetCatalog(pdf doc)" is not at all getting called. Now how can i extract my TOC from my pdf file? Kindly help me out of this. I am struggling on this for a week. Thanks in advance.
Unfortunately I think the two answers you refer to point to different implementation strategies, which are both possibly valid but are different.
The first question is what the PDF files you have and want to show in your app look like. There is no such thing as a predefined TOC object in a PDF file, there are simply different ways to emulate this. The two most common ways are:
A) Bookmarks, which are a way to add little pieces of text to a structured tree, where each piece of text points to a specific location in the PDF file. These bookmarks can be added in the design application or later (there are specific tools to do so) and they can implement whatever structure.
B) Your PDF file might contain something that looks like a classic TOC from a book, which is basically just text on the opening pages, optionally with hyperlinks to specific locations in the book.
The second link you refer to shows how to create user interface where you can show the TOC in. The remaining question then is to figure out what items you want to display in the TOC window. In this second link you point to, the solution presented is to provide hard-coded items specific to one specific book. Of course this approach is not very useful when you want to display just any book.
So the question you are left with is how to figure out what items to display and where they link to.
If you consider my possibility A) above: a PDF file with bookmarks, the answer could be relatively simple. Answer 1 you point to explains how to look at the different structures inside a PDF file - bookmarks are simply such a structure (Defined in section 12.3 of the PDF specification: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf)
This means you could use the techniques shown there to walk the different objects in the PDF file, and find each bookmark. The bookmark will give you the text to display and the actual location in the PDF file that text should jump to when clicked.
If you consider my possibility B) above: a PDF file without bookmarks but a classic TOC, this will be much harder to solve. Such table of contents are simply text on one or more pages, optionally with hyperlinks. Of course you could try to find all text on these pages (if you can figure out on which page the TOC starts and ends), but you'd then also have to figure out where that item links to. If there are no hyperlinks involved, that would be a daunting task.
So your first question should be how generic you want to solve this problem. Do you know which PDF files you'll want to display? Can you devise a TOC for these files yourself (as in your solution 2)? If not, can you be sure all PDF files contain bookmarks? The answer to those questions will largely determine the rest of your strategy...

ClientBundle in GWT - texture atlas

When ClientBundle created, images from bundle are represent on page as inline data (for ex. img src="data:image/gif;base64,R0lGODlh.... ) in FF, CH. Images are assigned to background so "background-position" attributes works fine.
As usually, MS IE makes problems. Instead of embedding image, IE creates image map/texture atlas/image cache (not so sure about the name) so "background-position" can't be used. Is there any way to disable creation of the image cache.
Also, is it possible to control data embedding. For long list of for ex. list items generated html is very big as same data is repeated from item to item.
How are you including the images? with #Sprite? Create one #Sprite style with nothing in it but the image. Then create styles for all the rest of the css as separate styles. In the code you can set an element to multiple styles. As for ie, look at using chrome-frame when it is an old version of ie.