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 - Exporting / Printing selected layer of pdf file
  FAQ FAQ  Forum Search   Register Register  Login Login

Exporting / Printing selected layer of pdf file

 Post Reply Post Reply
Author
Message
MartinCS View Drop Down
Beginner
Beginner
Avatar

Joined: 27 Nov 12
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote MartinCS Quote  Post ReplyReply Direct Link To This Post Topic: Exporting / Printing selected layer of pdf file
    Posted: 27 Nov 12 at 10:07AM
Hi,

is there a possibility to select a certain layer of a pdf file and export / print it with the original page size of the pdf file container programmatically? With other words, I do have a file which contains several layers. I would like to hide all layers except one specific layer and print it using a pdf printer driver.

Thank you for your support!


Cheers,
Martin
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 27 Nov 12 at 7:51PM
Hi Martin!

I would first make a copy of the original pdf to have a working file.
On this file i would delete all layers i don't want and then print out
the working file with one remaining layer.
QuickPDF supports this:
http://www.quickpdflibrary.com/help/quickpdf/LayersAndOptionalContentGroups.php
Have a look at DeleteLayer and LayerCount.
Additionally you should read all about contentstreams...

Cheers and welcome here,
Ingo



Edited by Ingo - 27 Nov 12 at 7:56PM
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: 28 Nov 12 at 3:19AM
Martin,

Layers are called OptionalContentGroup's (OCG's) in technical speak.  Quick PDF library has full support for  OCG's including functions.  Here is some code I just found showing how the functions are used.  (I am not sure what the function does though)



            int ret = QP.LoadFromFile("pdf_with_ocgs.pdf", "");

            int numberOfLayer = QP.OptionalContentGroupCount();

            int[] layerID = new int[numberOfLayer];
            string[] layerName = new string[numberOfLayer];

            string layerNameStr;

            for(int iLayer=0; iLayer < numberOfLayer; iLayer++)
            {
                layerID[iLayer] = QP.GetOptionalContentGroupID(1 + iLayer);
                layerName[iLayer] = QP.GetOptionalContentGroupName(layerID[iLayer]);
            }

            for (int iLayer = 0; iLayer < numberOfLayer; iLayer++)
            {
                //activating and deactivating the layers,
                // in order to have only a single one that is activated
                for (int iLayerTemp = 0; iLayerTemp < numberOfLayer; iLayerTemp++)
                {
                    QP.SetOptionalContentGroupVisible(layerID[iLayerTemp], iLayer == iLayerTemp ? 1 : 0);
                    QP.SetOptionalContentGroupPrintable(layerID[iLayerTemp], iLayer == iLayerTemp ? 1 : 0);
                }
                QP.UseUnsafeContentStreams(1);

                ret = QP.RenderPageToFile(100, 1, 7, "out" + iLayer.ToString() + ".tif");
                if (ret != 1)
                    MessageBox.Show("Render failed");
            }

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