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 - Problems with PDF Files so Big!
  FAQ FAQ  Forum Search   Register Register  Login Login

Problems with PDF Files so Big!

 Post Reply Post Reply
Author
Message
Tharos View Drop Down
Beginner
Beginner


Joined: 28 Dec 10
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tharos Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
BEvans View Drop Down
Beginner
Beginner
Avatar

Joined: 07 Nov 10
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote BEvans Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Tharos View Drop Down
Beginner
Beginner


Joined: 28 Dec 10
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tharos Quote  Post ReplyReply Direct Link To This Post Posted: 29 Dec 10 at 7:42AM
perfect!!! it worksss!!! with other changes in the document but adding some more code!!!!

thanksssss a lot!
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