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!
![]() |
Problems with PDF Files so Big! |
Post Reply
|
| Author | |
Tharos
Beginner
Joined: 28 Dec 10 Status: Offline Points: 16 |
Post Options
Thanks(0)
Quote Reply
Topic: Problems with PDF Files so Big!Posted: 28 Dec 10 at 3:29PM |
|
Hi everyone!
Im using the library for add text to a existing pdf file, using this code: QuickPDFAX0723.PDFLibrary QP = new QuickPDFAX0723.PDFLibrary(); int result = QP.UnlockKey("mykey"); int descriptor = QP.LoadFromFile(fich); if (descriptor == 0) { MessageBox.Show("Error","error"); } int paginas=QP.PageCount(); for (int i = 1; i <= paginas; i++) { try { QP.SelectPage(i); QP.NewLayer(); QP.AddTrueTypeFont("Arial", 1); QP.SetTextSize(60); QP.SetTransparency(50); QP.DrawRotatedText(155, 600, 315, "CONFIDENCIAL"); int OC1 = QP.NewOptionalContentGroup("Conf"); QP.SetLayerOptional(OC1); QP.CompressContent(); QP.CompressImages(1); QP.CompressFonts(1); QP.CompressPage(); QP.NewLayer(); QP.AddTrueTypeFont("Arial", 1); QP.SetTextSize(20); QP.SetTransparency(50); QP.DrawText(100, 750, usuario + " " + System.DateTime.Now); int OC2 = QP.NewOptionalContentGroup("Nombre"); QP.SetLayerOptional(OC2); QP.MoveLayer(descriptor, 1); QP.CompressContent(); QP.CompressImages(1); QP.CompressFonts(1); QP.CompressPage(); QP.SetOptionalContentGroupVisible(OC1, 0); QP.SetOptionalContentGroupPrintable(OC1, 1); QP.SetOptionalContentGroupVisible(OC2, 0); QP.SetOptionalContentGroupPrintable(OC2, 1); } Im trying to draw "Confidential" and the date and user of the document as a Watermark in all pages of pdf file. So, if my file size before this treatment is aprox 900 kb, after is aprox 24,5 MB!!!! I think this is impossible because drawrotatetext online writes text... I Like to solve this problem, if there are solution, because the disk space is important to me about this pdf file because its not only one: aprox i have to apply this treatment to 500 pdf files. thanksss everyone!!! PD: My english is horrible because i´m from spain and i´m not speak much!!! Edited by Tharos - 28 Dec 10 at 3:34PM |
|
![]() |
|
BEvans
Beginner
Joined: 07 Nov 10 Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 Dec 10 at 1:02AM |
|
A quick look: A lot of the stuff in your per page loop is only needed once per PDF. Some time reading the documentation on what each function does would help a lot as well.
// Once per PDF before per page loop QP.CompressImages(1); QP.CompressFonts(1); QP.AddTrueTypeFont("Arial", 1); // Once per PDF after after the per page loop completes // skip CompressPage as it just does the same only for a single page QP.CompressContent(); Edited by BEvans - 29 Dec 10 at 1:03AM |
|
![]() |
|
Tharos
Beginner
Joined: 28 Dec 10 Status: Offline Points: 16 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 Dec 10 at 7:42AM |
|
perfect!!! it worksss!!! with other changes in the document but adding some more code!!!!
thanksssss a lot! |
|
![]() |
|
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