Sign In  Sign Up Live-Chat

Setting Individual Page size and orientation

Last post 02-05-2008, 7:11 AM by saba_rathnam. 25 replies.
Page 1 of 2 (26 items)   1 2 Next >
Sort Posts: Previous Next
  •  01-22-2008, 9:12 AM 109943

    Setting Individual Page size and orientation

    Hi All

    I am using aspose.total for different purposes. I was able to generate the pdf from different sources but when i try to set the pagesize and orientation of individual page programmatically i was able to set for the entire document.

    If someone knows how to set the pagesize and orientation of individual page for any given pdf document it will be of great help.

    regards

    S.Saba

     
  •  01-22-2008, 12:53 PM 109981 in reply to 109943

    Re: Setting Individual Page size and orientation

    Hi,

    If you are using Aspose.Pdf then the page size is applied to each section. You can only set page sizes for whole sections. For more information please consult http://www.aspose.com/Products/Aspose.Pdf/Api/Set-Page-Size-and-Margins.html

    You ccan use Aspose.Pdf.Kit to set page size for individual pages. For more information please consult http://www.aspose.com/Products/Aspose.Pdf.Kit/Api/Aspose.Pdf.Kit.PdfPageEditor.html

    Thanks.

     
  •  01-22-2008, 7:46 PM 110021 in reply to 109981

    Re: Setting Individual Page size and orientation

    Hi Adeel

    Thanks for the response. I have tried using PdfPageEditor and tried accessing the Pages object but got error saying 'get accessor is not defined'. Is that the right way i am trying or if you can throw me a little sample that will help me a lot.

    regards

    S.Saba

     
  •  01-22-2008, 8:59 PM 110025 in reply to 110021

    Re: Setting Individual Page size and orientation

    Hi,

    Here is the code for your convenience. Please make sure that the source and destination PDF's should be different.

    [C#]

    PdfPageEditor pdfchanger = new PdfPageEditor();

    pdfchanger.BindPdf(@"D:\AsposeTest\ChangeFile.pdf");

    //Apply the changes to Page 1 only

    pdfchanger.Pages = new int[1] { 1 };

    Aspose.Pdf.Kit.PageSize pg = new Aspose.Pdf.Kit.PageSize();

    pg.Height = 700; //sets the page height

    pg.Width = 300; //sets page width

    pdfchanger.Zoom = 0.5f; //Zoom is set, otherwise whole data can't be seen

    pdfchanger.PageSize = pg; //Assigning PageSize object of Pdf.Kit to PdfPageEditor's PageSize property

    pdfchanger.Save(@"D:\AsposeTest\AfterChanges.pdf");

    Thanks.

     
  •  01-23-2008, 7:39 AM 110082 in reply to 110025

    Re: Setting Individual Page size and orientation

    Hi Adeel

    The code worked great. My need is pick the orientation of each page from the changefile and change the height,width property keeping the orientation intact.

    So what i need is to pick the pagesize for each page and set the pagesize with standard height and width keeping the orientation of each page intact. If i set only height and width without setting the orientation, it defaults to portrait.

    Also i have tried to set the pagesize of third page with the code

                pdfchanger.Pages = new int[1] { 3 };

    i expeted it to change the page size of page number 3 but i got the page settings changed for page 1. Kindly let me know if i am doing something wrong

    thanks & regards

    S.Saba

     

     
  •  01-23-2008, 10:50 AM 110119 in reply to 110082

    Re: Setting Individual Page size and orientation

    Hi,

    I have tested the your code as was able to reproduce the error. I have logged this as PDFKITNET-4341 in our issue tracking system. We will try our best to resolve this as soon as possible.

    For setting the orentation you can use PageSize.IsLandscape property.

    Thanks.

     
  •  01-23-2008, 12:48 PM 110136 in reply to 110119

    Re: Setting Individual Page size and orientation

    Hi Adeel

    Thanks for the quick response. Kindly let me know as soon as you have a solution for this. We have licenced aspose.total and this functionality is important for our application.

    regards

    S.Saba

     
  •  01-24-2008, 1:15 AM 110192 in reply to 110136

    Re: Setting Individual Page size and orientation

    Hi S.Saba,

    Thank you for reporting the problem.

    The bug has been fixed, and that will be included in our next publishing. Of course,we could offer you a Beta version if you need this urgently.

    Best regards,


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-24-2008, 6:57 AM 110264 in reply to 110192

    Re: Setting Individual Page size and orientation

    Hi Felix

    I am happy to know that the bug is fixed real quick. I am looking forward to have the beta version at the earliest possible.

    thanks

    S.Saba

     
  •  01-24-2008, 7:02 AM 110266 in reply to 110264

    Re: Setting Individual Page size and orientation

    Hi Felix

    Can i also know the next publish date in which the said fix will be included?

    thanks

    S.Saba

     
  •  01-24-2008, 2:04 PM 110335 in reply to 110266

    Re: Setting Individual Page size and orientation

    Attachment: Present (inaccessible)

    Hi S.Saba,

    Please try the attachment before we publish the new version. And we think the new version would be available in a month.

    Thanks,


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-25-2008, 2:22 PM 110524 in reply to 110335

    Re: Setting Individual Page size and orientation

    Hi Felix & Adeel

    I have tested the beta and it works. Pointing to my issue i have described above, i want to pick the previous setting of each page before setting the pagesize for each individual page. PdfPageEditor.Pages throws 'lacks get accessor'. Can you throw me a sample code to pick the page and set the page settings for each page for any given pdf.

    Thanks in advance.

    regards

    S.Saba

     
  •  01-27-2008, 12:44 AM 110577 in reply to 110524

    Re: Setting Individual Page size and orientation

    Hi S.Saba,

    The following is a sample. Here I  only get the previous setting of  one page.

    public void Test_getAndSetPages()
      {
       
       float  pageHeight,pageWidth;
       int  pageRotation;
       String thePdf = In_Path+"test.pdf";

       PdfFileInfo fileInfo = new PdfFileInfo(thePdf);      
           //get original info of page 1
       pageHeight = fileInfo.GetPageHeight(1);
       pageWidth = fileInfo.GetPageWidth(1);
       pageRotation = fileInfo.GetPageRotation(1);


          //adjust pagesize
       PageSize pSize = new PageSize();
       pSize.Width = pageWidth+150;
       pSize.Height = pageHeight+200;
          //adjust rotation
       pageRotation =pageRotation+90;

          //to reset pages
       PdfPageEditor pageEditor = new PdfPageEditor();
       pageEditor.BindPdf(thePdf);
       pageEditor.Pages=new int[4]{1,3,4,5};  //to reset all pages,just comment this line;
       pageEditor.PageSize = pSize;
       //pageEditor.Zoom=0.5f;                      // need zoom?
       pageEditor.Rotation=pageRotation;
       pageEditor.Save("D:\\pagesSetSample.pdf");
      
      }


    Felix Liu
    Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-28-2008, 8:41 AM 110703 in reply to 110577

    Re: Setting Individual Page size and orientation

    Hi Felix

    Thanks for the sample and it sloved my need with one exception. I am not sure if my approach is correct. I am little confused with PageRoatation and IsLandscape. In the sample, i was expecting to get the IsLandscape property for the page which is missing in PdfFileInfo class. Instead you are using GetPageRoation. Is that by design or there is a way i can get the IsLandscape property for the given page?

    regards

    S.Saba

     
  •  01-28-2008, 11:15 AM 110741 in reply to 110703

    Re: Setting Individual Page size and orientation

    Hi,

    Please use the GetRotation method as we have not implemented a seperate IsLandscape property because the GetRotation methods performs the same task.

    Thanks.

     
Page 1 of 2 (26 items)   1 2 Next >
View as RSS news feed in XML