Hi,
using latest version 10.5.2.395 of SimpleDLL Viewer SDK I try to render a PDF page not against a white page background (which works fine) but to a given colored background.
To do this instead of using PXCV_DrawPageToDC I tried it with PXCV_DrawPageToDIBSection but whatever color I set, I always get a white background (render flags are set to 0, so pxvrpf_NoTransparentBkgnd is no issue and also raster renderer is used).
So what am I doing wrong? Can you modify your sample app .\DelphiExamples\PDFXEditSimple\ so that the rendered page uses a red or blue page background?
In general: Can a colored or transparent background can be achieved also using PXCV_DrawPageToDC ? Best would be a way to get the page rendered above any arbitrary content of an existing DeviceContent, so any coloring or other background content will stay partially visible.
Thanks,
Ulrich
how to render to DC with colored/transparent background?
Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
- Daniel - PDF-XChange
- Site Admin
- Posts: 10728
- Joined: Wed Jan 03, 2018 6:52 pm
Re: how to render to DC with colored/transparent background?
Hello, ukograhl
Thank you for reaching out, I have informed our dev team of this case, and they will be looking into it as soon as they can. Unfortunately, I do not have an immediate answer I can provide you at the moment.
Just to clarify, you said you are using the version 10.5.2.395 of SimpleDLL Viewer SDK. Do you mean the "Editor Simple SDK" perchance? I don't believe the SimpleDLL Viewer SDK was ever updated beyond v2.5...
Also, if at all possible, could we request a snippet of the code running when you encounter such issues?
Kind regards,
Thank you for reaching out, I have informed our dev team of this case, and they will be looking into it as soon as they can. Unfortunately, I do not have an immediate answer I can provide you at the moment.
Just to clarify, you said you are using the version 10.5.2.395 of SimpleDLL Viewer SDK. Do you mean the "Editor Simple SDK" perchance? I don't believe the SimpleDLL Viewer SDK was ever updated beyond v2.5...
Also, if at all possible, could we request a snippet of the code running when you encounter such issues?
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Re: how to render to DC with colored/transparent background?
Hello Daniel,
yes, Editor Simple SDK (using PDFXEditSimple.x64.dll) to render a PDF page.
Thanks!
Ulrich
yes, Editor Simple SDK (using PDFXEditSimple.x64.dll) to render a PDF page.
Thanks!
Ulrich
Re: how to render to DC with colored/transparent background?
Oh, forgot to add the code:
- open your Delphi sample application .\Examples\DelphiExamples\PDFXEditSimple\
- on MainFrame.pas edit procedure TForm1.PaintBox1Paint(Sender: TObject);
Should'nt this create a red background?
- open your Delphi sample application .\Examples\DelphiExamples\PDFXEditSimple\
- on MainFrame.pas edit procedure TForm1.PaintBox1Paint(Sender: TObject);
Code: Select all
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
Res: HResult;
Param: PXV_CommonRenderParameters;
// new:
hBmp: HBitmap;
Btmp: TBitmap;
begin
if(m_pDocument = 0) then
Exit;
Param.WholePageRect := @m_rWholePage;
if(m_bFitPage)then
Param.DrawRect := nil
else
Param.DrawRect := @m_rDrawPage;
Param.RenderTarget := 0;
Param.Flags := 0;
with m_rWholePage do
PaintBox1.Canvas.Rectangle(Left - 1, Top - 1, Right + 1, Bottom + 1);
// Original Code
{Res := PXCV_DrawPageToDC(m_pDocument, m_nCurPage, PaintBox1.Canvas.Handle, @Param);
ErrorCheck(Res); }
// Testcode background:
Res := PXCV_DrawPageToDIBSection(m_pDocument, m_nCurPage, @Param, 0, $FF0000FF, @hbmp, 0, 0);
ErrorCheck(Res);
Btmp:= TBitmap.Create;
try
Btmp.Handle:=hBmp;
PaintBox1.Canvas.Draw(m_rWholePage.Left, m_rWholePage.Top, btmp);
finally
Btmp.Free;
end;
end;
- Daniel - PDF-XChange
- Site Admin
- Posts: 10728
- Joined: Wed Jan 03, 2018 6:52 pm
Re: how to render to DC with colored/transparent background?
Hello, ukograhl
I believe you are correct, but I am not a Developer myself, so admittedly this does go a bit over my head.
I can confirm that we have a bug/investigation ticket in place for you on this issue now. Once that investigation is complete, you should see a reply here. For now, as with all tickets, this is an internal item, but the ticket number is as follows:
RT#7417: Delphi - Simple SDK - background color/transparency
I have added your code snippet to the notes as well, for quick access.
Kind regards,
I believe you are correct, but I am not a Developer myself, so admittedly this does go a bit over my head.
I can confirm that we have a bug/investigation ticket in place for you on this issue now. Once that investigation is complete, you should see a reply here. For now, as with all tickets, this is an internal item, but the ticket number is as follows:
RT#7417: Delphi - Simple SDK - background color/transparency
I have added your code snippet to the notes as well, for quick access.
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Re: how to render to DC with colored/transparent background?
Hello Daniel!
Thanks for looking on this problem. Will wait for the results.
kind regards,
Ulrich
Thanks for looking on this problem. Will wait for the results.
kind regards,
Ulrich
- Stefan - PDF-XChange
- Site Admin
- Posts: 19745
- Joined: Mon Jan 12, 2009 8:07 am
- Contact: