Dear All,
I use the method IPXC_Page.DrawToDevice() to generate thumbnails and that works fine if there is not a large number of pdf pages.
But,as the number of pdf pages increase,the performance is significantly decline.
For instance,I have a pdf with 19pages,and it will take about 5s to generate thumbnails from it that is much longer than your Eidtor SDK do.
I guess that maybe your Editor SDK use a different method or optimized parameters.
I have uploaded a screenshot containing the key code,and I hope it could provide all the information you need.
I hope you can help to analyse what cause the performance issue.
I am waiting for your reply anxiously.
Thanks in advance.
IPXC_Page.DrawToDevice has a performance issue
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
IPXC_Page.DrawToDevice has a performance issue
- Attachments
-
- 2.rar
- (951.83 KiB) Downloaded 108 times
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Page.DrawToDevice has a performance issue
Hello kyo,
The problem is that you are using the DrawToDevice method that is mainly used for printing and it should not be used as you are using it if we are talking about efficiency. The correct method to use would be DrawToIXCPage. Here's a small sample on how to use it:
https://forum.pdf-xchange.com/ ... 42#p101442
Also, check out this post - it contains a sample on how to convert a IIXC_Page to Bitmap and vise versa:
https://forum.pdf-xchange.com/ ... 97#p106897
Cheers,
Alex
The problem is that you are using the DrawToDevice method that is mainly used for printing and it should not be used as you are using it if we are talking about efficiency. The correct method to use would be DrawToIXCPage. Here's a small sample on how to use it:
https://forum.pdf-xchange.com/ ... 42#p101442
Also, check out this post - it contains a sample on how to convert a IIXC_Page to Bitmap and vise versa:
https://forum.pdf-xchange.com/ ... 97#p106897
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: IPXC_Page.DrawToDevice has a performance issue
Code: Select all
uint Pt2Px(double nPoint, double nDPI)
{
return (uint)((nPoint / 72.0) * nDPI + 0.5);
}
//Creating empty dest IIXC_Page including DPI
PDFXEdit.IIXC_Page iDestPage = iInst.Page_CreateEmpty(Pt2Px(nW, nDPI), Pt2Px(nH, nDPI), PDFXEdit.IXC_PageFormat.PageFormat_8RGB, 0x0000FF);
//Creating destination image rect
PDFXEdit.tagRECT destRect;
destRect.left = 0;
destRect.bottom = 0;
destRect.right = (int)iDestPage.Width;
destRect.top = (int)iDestPage.Height;
//Getting page matrix
PDFXEdit.PXC_Matrix srcPageMatrix = srcPage.GetMatrix(PDFXEdit.PXC_BoxType.PBox_PageBox);
//Getting source page Page Box without rotation
PDFXEdit.PXC_Rect srcRect = srcPage.get_Box(PDFXEdit.PXC_BoxType.PBox_PageBox);
//Getting visual source Page Box by transforming it through matrix
TransformRect(srcPageMatrix, ref srcRect);
//Filling destination iPage with the image
srcPage.DrawToIXCPage(iDestPage, ref destRect, ref srcPageMatrix);
I find that the struct PDFXEdit.PXC_Matrix is difficult to understand ,not to mention transforming it,so I want you give me the sample code to implement the function "TransformRect(srcPageMatrix, ref srcRect)".
I have done a test, if I ignore the function "TransformRect(srcPageMatrix, ref srcRect)",I will get an strange image.
Now,I need to know how to implement the function "TransformRect(srcPageMatrix, ref srcRect)",please give me a sample.
Thanks in advance.
Re: IPXC_Page.DrawToDevice has a performance issue
Dear All,
I have created a simple C# project using the DrawToIXCPage method to generate thumbnails as your links told me to do.
The result is that the project can run smoothly,but no thumnail is displayed(maybe some coordinate is not correct).
I have a strong feeling that the destination page(IIXC_Page) maybe is rotated,and also I pass a incorrect PXC_Matrix to the DrawToIXCPage method.
I have upload the simple project which can work well.It will be very appreciated that if you can assist me to modify the code to implement my goal.
Thanks very much.
I have created a simple C# project using the DrawToIXCPage method to generate thumbnails as your links told me to do.
The result is that the project can run smoothly,but no thumnail is displayed(maybe some coordinate is not correct).
I have a strong feeling that the destination page(IIXC_Page) maybe is rotated,and also I pass a incorrect PXC_Matrix to the DrawToIXCPage method.
I have upload the simple project which can work well.It will be very appreciated that if you can assist me to modify the code to implement my goal.
Thanks very much.
- Attachments
-
- PDF-XchangeDemo_simple.zip
- (2.11 MiB) Downloaded 110 times
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Page.DrawToDevice has a performance issue
Hello kyo,
In your case, the correct code would look like this:
Cheers,
Alex
In your case, the correct code would look like this:
Code: Select all
PDFXEdit.IIXC_Page iDestPage = ixcInst.Page_CreateEmpty((uint)page_pixel_W, (uint)page_pixel_H, IXC_PageFormat.PageFormat_8RGB, 0x00FFFF);
PDFXEdit.tagRECT destRect;
destRect.left = 0;
destRect.bottom = (int)iDestPage.Height;
destRect.right = (int)iDestPage.Width;
destRect.top = 0;
PDFXEdit.PXC_Matrix srcPageMatrix = srcPage.GetMatrix(PDFXEdit.PXC_BoxType.PBox_PageBox);
PDFXEdit.PXC_Rect srcRect = srcPage.get_Box(PDFXEdit.PXC_BoxType.PBox_PageBox);
auxInst.MathHelper.Rect_Transform(srcPageMatrix, ref srcRect);
PDFXEdit.PXC_Rect dRect;
dRect.left = destRect.left;
dRect.top = destRect.top;
dRect.right = destRect.right;
dRect.bottom = destRect.bottom;
PDFXEdit.PXC_Matrix destMatrix = auxInst.MathHelper.Matrix_RectToRect(srcRect, dRect);
destMatrix = auxInst.MathHelper.Matrix_Multiply(srcPageMatrix, destMatrix);
srcPage.DrawToIXCPage(iDestPage, ref destRect, ref destMatrix);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 141
- Joined: Sat Aug 27, 2016 11:00 am
Re: IPXC_Page.DrawToDevice has a performance issue
Hello,
I want to do this by simple document file rather then pdf control, that you did in attached zip file.
so, it's possible??
if, yse than how??
I want to do this by simple document file rather then pdf control, that you did in attached zip file.
so, it's possible??
if, yse than how??
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: IPXC_Page.DrawToDevice has a performance issue
Hello vivekpatel,
Please provide detailed description of what you need only then I can assist further.
Cheers,
Alex
Please provide detailed description of what you need only then I can assist further.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ