-
Notifications
You must be signed in to change notification settings - Fork 846
[syncfusion_flutter_pdf] Can not insert a page at specific index #2353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @marcsanny , Yes, it's possible to insert a PDF page at a specific index in a newly created PDF document using Syncfusion Flutter PDF package. There are a couple of ways to achieve this based on your requirements. Method 1: Inserting an Empty Page at a Specific Index You can insert an empty page at any specific index in a PDF document using the insert method:
Method 2: Inserting a Page from Another PDF Document To insert a page from an existing PDF at a specific index in your document:
The key part is using document.pages.insert(index) to add an empty page at the specified index, or you can use it to insert and then immediately add content from another PDF document using templates. To read PDF files from your Flutter project, you'll need to set up proper file handling as
This allows you to insert pages from existing PDFs at specific indexes in your newly created PDF document |
Please share with us your complete requirements so that we can assist with you further in this |
Bug description
We are not able to insert a page at specific index (
add()
method works as expected). We get: Null check operator used on a null valueIt seems like the line is causing the error:
Steps to reproduce
Code sample
Minimal reproducible code:
Code sample
The text was updated successfully, but these errors were encountered: