Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

How does the ReplaceTag function work?

Question

When using the ReplaceTag function to replace some text in a PDF document created with Quick PDF Library everything works fine, but when using the same function to replace text in a PDF document NOT created with Quick PDF Library, this function fails. The documents I tested are not encrypted.

Answer

The ReplaceTag function simply replaces text in the page's content stream, so for most documents it wouldn't have any effect.

For some simple documents it might be able to replace content, but it really depends on how the PDF was constructed.

Essentially it's the same as doing:

QP.CombineLayers();
string content = QP.GetPageContent();
QP.SetPageContent(content.Replace("Moby", "Tom"));

If you created a PDF using Quick PDF Library and a standard font then the ReplaceTag function should work - however, for PDFs created with tools that do subsetted fonts or even kerning (where words will be split up) then the search text probably won't be in the content in a simple format.

So in short, the ReplaceTag function will only work in some limited scenarios and isn't a function that you can rely on for searching and replacing text.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum