Print Page | Close Window

Content Stream <> Layers

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3061
Printed Date: 01 May 25 at 3:21PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Content Stream <> Layers
Posted By: mLipok
Subject: Content Stream <> Layers
Date Posted: 03 Feb 15 at 7:36PM
here:
http://www.debenu.com/products/development/debenu-pdf-library/features/pdf-layers-sdk/

I read:

"All PDF content is grouped into Content Streams. A Content Stream might include, for example, formatted text, an image or a form field. These elements can be precisely placed to produce the familiar pages we see in our PDF viewers."
and
"we would say that Content Streams can be placed on individual Layers."

I want to ask:
What is a difference between Content Stream <> Layers ?

As I understand it the Content Stream
is simply the content of the layers




-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600



Replies:
Posted By: AndrewC
Date Posted: 05 Feb 15 at 5:16AM
Michal,

Content streams are just a way to break up a large single content stream into blocks though it is not really necessary.  When the PDF is rendered it effectively combines all of the streams during rendering, stream 1 is rendered first then stream 2 and so on.

There are some special cases but this is for advanced usage and requires special attention to make sure the streams are valid.

1. Shared Content Stream - A background template may be created for page 1 of a PDF and that content stream can be shared for all subsequent pages.

2. Sometimes Debenu PDF Library customers create a new stream, add a watermark type logo to the stream and then move / insert the content stream as stream 1.  This has the effect of drawing the watermark image first so that all other content is drawn on top.

3. Some people use a contentstream for each Optional Content Group which is the closest thing to layers in the PDF format.  Again this needs to be managed carefully.

If content streams are used for layering then they should be self contained and begin with a SaveState and finish with a RestoreState command in order to restore the grapihcs state, scaling, rotation etc..

Content streams can be used for various reasons.  When you want to use CapturePage / DrawCapturedPage in the library then you should call QP.RemoveSharedContentStreams which creates copies of contents streams so that none are shared, making the PDF larger, but allowing the pages of the PDF to be extracted without errors.  ie.  If you delete page 1 that contains the shared content stream them all other pages would become invalid because of the missing shared content stream.  Also a call to QP.CombineContentStreams is required so that all streams are merged into one single stream that makes copying quicker and easier.

Andrew.


Posted By: mLipok
Date Posted: 05 Feb 15 at 9:11PM
Thanks for such a broad explanation
mLipok



-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk