Hi Team,
I am using vb.net code which you have provided on below link and trying to give page number to PDF which has 15000 pages.
But this gives me out of memory error.
please help me to overcome this.
I am using latest aspose.pdf dll.
http://www.aspose.com/docs/display/pdfnet/Add+Page+Number+Stamp+in+a+PDF+File
how can I save the file in incremental mode like after each 1000 page I want to save.
Please reply me as this is very urgent issue for me.
rajsingh85007:
Hi Team,I am using vb.net code which you have provided on below link and trying to give page number to PDF which has 15000 pages.
But this gives me out of memory error.
please help me to overcome this.
I am using latest aspose.pdf dll.http://www.aspose.com/docs/display/pdfnet/Add+Page+Number+Stamp+in+a+PDF+File
Aspose.Pdf for .NET manipulates the PDF file and save the resultant document at once. However as a workaround, you may consider creating a temporary PDF file of 1000 pages, perform the manipulation (add text stamp) and save the output. You can repeat the same process for required number of times and then concatenate the resultant files. For further details, please visitrajsingh85007:
how can I save the file in incremental mode like after each 1000 page I want to save.
We are sorry for this inconvenience.
I will send pdf soon but how can I add page stamp and then concatenate? support I have two pdf one is of 1000 page and other is of 800 page. when I merge these two I want to show page 1 of 1800, page 2 of 1800 and so on. how to get total number of pages from two separate pdf?
File attached.
Hi Rajsingh,
//
load source PDF file<o:p></o:p>
Document doc = new Document("c:/pdftest/1.pdf");
// get total page count information
<span style=“font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
“Malgun Gothic”;mso-fareast-theme-font:minor-fareast;color:#2B91AF;background:
white;mso-highlight:white;mso-ansi-language:EN-US;mso-fareast-language:KO;
mso-bidi-language:AR-SA”>Console.WriteLine(<span style=“font-size:9.5pt;line-height:115%;font-family:Consolas;mso-fareast-font-family:
“Malgun Gothic”;mso-fareast-theme-font:minor-fareast;color:#A31515;background:
white;mso-highlight:white;mso-ansi-language:EN-US;mso-fareast-language:KO;
mso-bidi-language:AR-SA”>"Total pages in PDF = " +doc.Pages.Count);
Can you please respond to my query ASAP?
Hi Rajsingh,
’
instantiate Document Object<o:p></o:p>
Dim doc As Document = New Document("c:/pdftest/1.pdf")
Dim doc2 As Document = New Document("c:/pdftest/ChartsandGraphs.pdf")
' concatenate the page of PDF documents
doc.Pages.Add(doc2.Pages)
'create page number stamp
Dim pageNumberStamp As New PageNumberStamp()
'whether the stamp is background
pageNumberStamp.Background = False
pageNumberStamp.Format = "Page # of " & doc.Pages.Count
pageNumberStamp.BottomMargin = 10
pageNumberStamp.HorizontalAlignment = HorizontalAlignment.Center
pageNumberStamp.StartingNumber = 1
'set text properties
pageNumberStamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial")
pageNumberStamp.TextState.FontSize = 14.0F
pageNumberStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold
pageNumberStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Italic
pageNumberStamp.TextState.ForegroundColor = Color.Aqua
Dim page_counter As Integer = 1
For Each page As Page In doc.Pages
'add stamp to particular page
doc.Pages(page_counter).AddStamp(pageNumberStamp)
page_counter += 1
Next
doc.Save("c:/pdftest/StampAdded.pdf")
Thank for this but when we do doc.Pages.Add(doc2.Pages) it will again have issue of out of memory.
Hi Rajsingh,
I have created small files and now i want to give stamp like pdf 1 has got 1000 page and pdf 2 got 800.i have also got total number of pages count as 1800 in variable.now when i am giving stamp to individual file first file is getting 1 of 1800, 2 of 1800 and so on.but 2nd file is also getting 1 of 1800 , 2 of 1800 and so on.but i want to give second file as 1001 of 1800,1002 of 1800 and so on.meaning i want to pass value of # for the below syntax whichi should increment.
pageNumberStamp.Format = "Page # of " & i
rajsingh85007:
I have created small files and now i want to give stamp like pdf 1 has got 1000 page and pdf 2 got 800.i have also got total number of pages count as 1800 in variable.now when i am giving stamp to individual file first file is getting 1 of 1800, 2 of 1800 and so on.but 2nd file is also getting 1 of 1800 , 2 of 1800 and so on.but i want to give second file as 1001 of 1800,1002 of 1800 and so on.meaning i want to pass value of # for the below syntax whichi should increment.
pageNumberStamp.Format = "Page # of " & i
With 6000 page file which is of size 31 mb i am getting out of memory error.i cannot further break this file. also i am unable to attach this file over here.please let me know how to send that file so that you can replicate this issue.
In my below code i get out of memory when i try to add stamp for page 630.
doc10 = New Document"\\ysiinvgs3Reports70rel\Demo\temp\OG\MINTRA_42430010_0.pdf")
For Each page As Page In doc10.Pages
pageNumberStamp.Format = "Page" & total_page_counter & " of " & i
doc10.Pages(page_counter).AddStamp(pageNumberStamp)
page_counter += 1
Next
doc10.Save("\\ysiinvgs3\Reports70rel\Demo\temp\OG\MINTRA_424300010_S.pdf")
please help me in solve this issue as its very urgent now.
Hi Rajsingh,
Here is the file.
https://drive.google.com/file/d/0B0VMx4LFjvKoRHk0eDhEWWJac0U/edit?usp=sharing
please take it and let me know ASAP as this is super urgent.
rajsingh85007:
Here is the file. https://drive.google.com/file/d/0B0VMx4LFjvKoRHk0eDhEWWJac0U/edit?usp=sharingplease take it and let me know ASAP as this is super urgent.
I have given access of file.
please investigate and let me know ASAP.
Hi Rajsingh,
’ instantiate Document Object<o:p></o:p>
Dim doc As Document = New Document("c:/pdftest/AAMINTRA_42430011_0.pdf")
'Dim doc2 As Document = New Document("c:/pdftest/ChartsandGraphs.pdf")
' concatenate the page of PDF documents
'doc.Pages.Add(doc2.Pages)
'create page number stamp
Dim pageNumberStamp As New PageNumberStamp()
'whether the stamp is background
pageNumberStamp.Background = False
pageNumberStamp.Format = "Page # of " & doc.Pages.Count
pageNumberStamp.BottomMargin = 10
pageNumberStamp.HorizontalAlignment = HorizontalAlignment.Center
pageNumberStamp.StartingNumber = 1
'set text properties
pageNumberStamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial")
pageNumberStamp.TextState.FontSize = 14.0F
pageNumberStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold
pageNumberStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Italic
pageNumberStamp.TextState.ForegroundColor = Aspose.Pdf.Color.Aqua
Dim page_counter As Integer = 1
For Each page As Page In doc.Pages
'add stamp to particular page
doc.Pages(page_counter).AddStamp(pageNumberStamp)
page_counter += 1
Next
doc.Save(“c:/pdftest/AAMINTRA_42430011_0_StampAdded.pdf”)
Can you try with framework 2 target platform as I am having that.
Hi Rajsingh,