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!
![]() |
Exporting / Printing selected layer of pdf file |
Post Reply ![]() |
Author | |
MartinCS ![]() Beginner ![]() ![]() Joined: 27 Nov 12 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Martin, http://www.quickpdflibrary.com/help/quickpdf/SetOptionalContentGroupPrintable.php http://www.quickpdflibrary.com/help/quickpdf/GetOptionalContentGroupName.php 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"); } |
|
![]() |
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