Hi,
I need to evaluate export to image functionality of Core API SDK.
Unfortunately in the samples provided (Samples\cpp\MFCSample\Sample_ExportToImage.cpp) the method HRESULT CSDKSample_ExportToImage::Perform() is not implemented.
https://www.pdf-xchange.com/pdf-cre ... ison-chart
Here I see that this API should support "Export / Render Page / File to Raster Image Format".
Can you please provide me a sample code.
Best Regards,
Vassil
CSDKSample_ExportToImage not implemented
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: CSDKSample_ExportToImage not implemented
Hello Vassil,
I wrote this code some time ago and it should be somewhere on the dev. forums, though I will duplicate it here:
Cheers,
Alex
I wrote this code some time ago and it should be somewhere on the dev. forums, though I will duplicate it here:
Code: Select all
PDFXEdit.IPXC_Page srcPage = pdfCtl.Doc.CoreDoc.Pages[0];
//Getting source 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
auxInst.MathHelper.Rect_Transform(srcPageMatrix, ref srcRect);
//We'll insert the visual src page into visual dest page indented rectangle including page rotations and clipping
PDFXEdit.PXC_Rect destRect;
//destRect.left = 0;
//destRect.right = 300;
//destRect.top = 0;
//destRect.bottom = 300;
destRect = srcRect;
destRect.top = srcRect.bottom;
destRect.bottom = srcRect.top;
Bitmap image = new Bitmap((int)(destRect.right - destRect.left), (int)(destRect.bottom - destRect.top));
PDFXEdit.PXC_Matrix pageToRectMatrix = auxInst.MathHelper.Matrix_RectToRect(srcRect, destRect);
PDFXEdit.tagRECT rcTmp;
rcTmp.left = (int)destRect.left;
rcTmp.right = (int)destRect.right;
rcTmp.top = (int)destRect.top;
rcTmp.bottom = (int)destRect.bottom;
pageToRectMatrix = Multiply(srcPageMatrix, pageToRectMatrix);
Graphics g = Graphics.FromImage(image);
g.Clear(Color.White);
IntPtr hdc = g.GetHdc();
srcPage.DrawToDevice((uint)hdc, ref rcTmp, ref pageToRectMatrix, 0);
g.ReleaseHdc(hdc);
image.Save("D:\\PageImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: CSDKSample_ExportToImage not implemented
With some changes the code it working fine.
Thanks a lot!
Thanks a lot!
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: CSDKSample_ExportToImage not implemented
Glad that helped
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1
- Joined: Tue Sep 21, 2021 6:36 am
Re: CSDKSample_ExportToImage not implemented
pageToRectMatrix = Multiply(srcPageMatrix, pageToRectMatrix);
Sorry I want to ask about this line is it equal to :
pageToRectMatrix = srcPageMatrix * pageToRectMatrix
Since my vbnet code cannot recognize the multiply. I thought you may be declare somewhere.
Sorry I want to ask about this line is it equal to :
pageToRectMatrix = srcPageMatrix * pageToRectMatrix
Since my vbnet code cannot recognize the multiply. I thought you may be declare somewhere.
- Tracker Supp-Stefan
- Site Admin
- Posts: 17948
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: CSDKSample_ExportToImage not implemented
Hello NuRaSoBODS,
If your programming environment can multiply matrices with just the * symbol - then sure - it is probably equal. Have you given it a try already and does it work for you?
Kind regards,
Stefan
If your programming environment can multiply matrices with just the * symbol - then sure - it is probably equal. Have you given it a try already and does it work for you?
Kind regards,
Stefan