Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
How to preview selected Content Stream? |
Post Reply ![]() |
Author | |
ExchangeViews ![]() Team Player ![]() ![]() Joined: 13 Mar 12 Status: Offline Points: 38 |
![]() ![]() ![]() ![]() ![]() Posted: 19 Jun 12 at 1:18PM |
How can I see the Selected Content Stream? I have a pdf with 2 Content Stream count. I want to see the preview of selected Content Stream to delete. Can anyone please help me? I am using following code:
QP:=TQuickPDF0815.Create; QP.UnlockKey('XXXXXXXX'); QP.LoadFromFile(ListView1.Items[0].SubItems[2],''); //ShowMessage(IntToStr(QP.ContentStreamCount)); (2) QP.SelectContentStream(2); QP.DeleteContentStream; QP.SaveToFile('d:\new.pdf'); Many thanks in advance. |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
It is not always safe to delete a content stream unless the PDF is created with this deletion in mind.
Content streams are like a pages of a book. Sentences, words, paragraphs can be broken across multiple pages. If you rip out a page then it it very likely that the book no longer makes sense - ie broken words, sentence, paragraph. If the page was a single page chapter then it might be possible to rip out the page but still be able to read the book without syntax or spelling errors but the but book has to be designed that way in the first place. There are no fixed rules as to how content streams are to be stored. ContentStream 1= "The Quick" ContentStream 2= "brown fo" ContentStream 3= "x jumped over the " ContentStream 4= "lazy " ContentStream 5= "dogs back" If you delete stream 4 then it reads "the quick brown fox jumped over the dogs back" If you delete stream 2 then it reads "the quick x jumped over the lazy dogs back" A PDF works in exactly the same way and if there is a syntax error then the PDF can no longer be rendered correctly. So it doesn't make sense to work with content streams. You should look into OptionalContentGroups as they are designed to work as layers. Andrew.
|
|
![]() |
|
ExchangeViews ![]() Team Player ![]() ![]() Joined: 13 Mar 12 Status: Offline Points: 38 |
![]() ![]() ![]() ![]() ![]() |
I have a pdf file which has a watermark on it. When i use ContentStreamCount, it shows 2 as count. Now i use following code:
QP.SelectContentStream(2); QP.DeleteContentStream; QP.SaveToFile('d:\new.pdf'); This new pdf is now watermark free. The only problem is that i want to preview both ContentStream to select an appropriate one to delete. |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Your approach may work on certain PDF files but it will not work on most PDF files.
There is no easy way. You could delete the ContentStream, SaveToFile and then RenderPageToFile - Another option may be to copy the ContentStream to a string, replace it with a space character, call RenderPageToFile and then replace the ContentStream contents with the string you saved.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store