please send me the vb.net code for the full procedure for my requirement.
Can you please respond to my query ASAP?
Hi Rajsingh,
Please try using the following code snippet to accomplish your requirement.
[VB.NET]
' instantiate Document Object
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,
Thanks for granting the permissions. I have tested the scenario using the following code snippet with the latest release of Aspose.Pdf for .NET 9.5.0 and I am unable to notice any problem when using a Visual Studio 2010 project with the target platform as .NET Framework 4.0, running over a Windows 7 (x64) machine. My system configurations are Intel Core i5, 2.5 Ghz with 4 GB of RAM.
Can you please try using the latest release version and see if it resolves your problem? For your reference, I have also attached the resultant PDF generated on my end. Please access the file over this link.
[VB.NET]
'instantiate Document Object
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,
HI,
I tried with latest apse.pdf dll and its working fine.
can you pelase try once with 7.3.0.0 version dll?
Hi Rajsingh,
i cannot use latest dll jsut like that. all i am asking is to try once at your end with 7.3.0 dll and see if you get the stamped pdf or not. i am not asking to resolved in this version. jsut test and let me know.
I cant even test fully as its putting stamp only on 4 pages and if i add my license then get this error. how do u expect me to test?
The subscription included in this license allows free upgrades until 25 Jun 2014, but this version of the product was released on 31 Jul 2014. Please renew the subscription or use a previous version of the product.
Hi Rajsingh,
I have tested the scenario using Aspose.Pdf for .NET 7.3.0 and have managed to notice the OutOfMemory Exception.
Now concerning to testing 9.5.0 without any limitations, you may consider requesting a 30 days temporary license. For further information, please visit Get a temporary license