
Hi,
I have: Telerik UI for ASP.NET AJAX
I test SplitDocumentPages from PDF example. from https://github.com/telerik/document-processing-sdk/blob/master/PdfProcessing/ManipulatePages/Program.cs
net.framework: 4.8
test pdf is: https://github.com/telerik/document-processing-sdk/blob/master/PdfProcessing/ManipulatePages/InputFiles/MultipageDocument.pdf
Not working well. see picture split1.pdf, only large rectangle without any data.
Please help.
Thx
2 Answers, 1 is accepted
Hi,
Judging by the screenshot, the PDF File was generated with the Trial message "This document was generated by a trial version of Telerik Document Processing". This means the PDF Processing library is working. Since there is no other content in the PDF document, that indicates that the code that is supposed to split the document is incorrect.
The code from the Example will not work in without making changes as it was written for Windows applications. Write a code specific to ASP.NET:
Please make sure that the Paths pointing to the MultiPage and destination directory are correct. In ASP.NET, you can use the Server.MapPath method to convert relative path absolute path.
Here is an example:
const string MultiPageDocument = "~/MultipageDocument.pdf";
const string ResultsDireName = "~/Documents";
private void SplitDocumentPages()
{
string documentToSplit = Server.MapPath(MultiPageDocument);
using (PdfFileSource fileToSplit = new PdfFileSource(File.OpenRead(documentToSplit)))
{
for (int i = 0; i < fileToSplit.Pages.Length; i++)
{
PdfPageSource page = fileToSplit.Pages[i];
string splitDocumentName = Path.Combine(Server.MapPath(ResultsDireName), string.Format("{0}.pdf", i + 1));
using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(splitDocumentName)))
{
fileWriter.WritePage(page);
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
SplitDocumentPages();
}
I hope this will help resolve the issue.
Regards,
Attila Antal
Progress Telerik
Hi, thanks for answer.
I try with payed Telerik ASP.NET AJAX.
In source pdf:
This is the result.
Hi,
Can you please try the code I shared to split the following MultiPage PDF file to Multiple PDF files and tell me how it goes?:
MultiPage Pdf Document: https://github.com/telerik/document-processing-sdk/blob/master/PdfProcessing/ManipulatePages/InputFiles/MultipageDocument.pdf
You should get this result:
yes 21 files is created.
my result is:
and your result (content) in pdf is?
thx
Maybe there's is something missing in your app.
Do you have all the Assemblies included in the Project for this to happen?
- Telerik.Windows.Documents.Core.dll
- Telerik.Windows.Documents.Fixed.dll
- Telerik.Windows.Zip.dll
Are you using the same exact code I showed you?
This is what I get. Each page from 1 through 21 has content.
I'm afraid I am out of ideas. It seem you have everything set, yet the results show differently.
To be able to help, I will need some more information so I can replicate the issue. Can you share the WebForms page (ASPX and ASPX.cs files) so I can review the code you are using to split the PDF contents?
I create console application. Then write results, and share application.
thx
I send zip file. Pass:ManipulatePages
[ attachment removed by Admin ]
Thanks for sharing the sample. I have tested it and it works as expected. See the screenshots with the directory "Demo results" containing the PDF files and the contents of the first file that I opened. I believe at this point the issue is with something other than the Document Processing library. Please make sure that the application has enough permissions to write to the disk.
Note: I have removed the sample from your response as it contains the non-trial assemblies and sharing this in a public website is forbidden and carries legal consequences.
Screenshot
Did it work for you with my dlls?
licx is not needed?
I don't understand why it doesn't work. I'm disappointed with that. I don't know what else to set to make it work.
Yes, I ran the sample you shared with the included assemblies and worked flawlessly. Try running Visual Studio as Administrator then load this solution into it. Run the application and see if that makes a difference.
The license.licx file is generated by Visual Studio automatically for licensed assemblies. You can delete this file without any problems. VS will generate another one automatically.

We are doing something wrong.
As i try any pdf to split in Demos - Telerik UI for ASP.NET Core 2024 Q3 installed on my competer it works ok.
But if i try the code above in Telerik UI for ASP.NET AJAX 2024 Q3 project, then i get correct amount of pages but with no content or the content is cropped. It looks like splitting pages gives me wrong page size and not take properties from original documents.
Where is tha hack?
Hello,
My name is Yoan, from the Document Processing team. I am joining this conversation to verify whether or not this case is PdfProcessing-related. I hope you don't mind, but I am opening a separate support ticket 1667995 on your behalf with the corresponding PdfProcessing product, so we can have a separate isolated discussion. If you have any questions or feedback you would like to follow up with, please feel free to do so in the newly open thread (1667995) for the time being.
Thank you for your understanding.
Regards,
Yoan
Hello Richard,
Please excuse me for the misunderstanding. The newly created support ticket is under the following number - 1668051.
Regards,
Yoan