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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - How to preview selected Content Stream?
  FAQ FAQ  Forum Search   Register Register  Login Login

How to preview selected Content Stream?

 Post Reply Post Reply
Author
Message
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Topic: How to preview selected Content Stream?
    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.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 12 at 12:12PM
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.
Back to Top
ExchangeViews View Drop Down
Team Player
Team Player
Avatar

Joined: 13 Mar 12
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote ExchangeViews Quote  Post ReplyReply Direct Link To This Post Posted: 22 Jun 12 at 1:53PM
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. 
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jun 12 at 8:54AM
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store