When viewing a document, is it possible to temporarily hide pages of the document from view?
For example, if I want to show only pages that have images on them, and I know which pages those are, is there a way that I can programmatically hide the other pages from view so that I do not see them when scrolling through the document? I would like to do this without having to create a separate temporary document if at all possible.
Thank you!
Temporarily Hide / Filter Pages in a Document
Re: Temporarily Hide / Filter Pages in a Document
Hello there,
Technically it is possible by creating a GdPicture object of a document and modifying that object by deleting the pages without any image on them and loading it back to the viewer.
The real document will keep its integrity and you will be able to save the modified document after.
And if you want to modify the pages and save them back to the initial document, you'll just need to replace them according to the initial positions you saved in an array.
Something like this:
Hope it helps!
With best,
Fabio
Technically it is possible by creating a GdPicture object of a document and modifying that object by deleting the pages without any image on them and loading it back to the viewer.
The real document will keep its integrity and you will be able to save the modified document after.
And if you want to modify the pages and save them back to the initial document, you'll just need to replace them according to the initial positions you saved in an array.
Something like this:
Code: Select all
GdPicturePDF oPDF = new GdPicturePDF();
GdPictureStatus status;
if (oPDF.LoadFromFile("input.pdf", false) == GdPictureStatus.OK)
{
int i = 1;
int pageCount = oPDF.GetPageCount();
if (pageCount > 0)
{
while (i <= pageCount)
{
oPDF.SelectPage(i);
int imageCount = oPDF.GetPageImageCount();
status = oPDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (imageCount == 0)
{
oPDF.DeletePage(i);
}
}
i++;
}
}
oPDF.SaveToFile("output.pdf");
oPDF.Dispose();
}
Hope it helps!
With best,
Fabio
Who is online
Users browsing this forum: No registered users and 0 guests