Print Page | Close Window

Rendering to DC in virtual PC environment

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3588
Printed Date: 29 Mar 24 at 3:59PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Rendering to DC in virtual PC environment
Posted By: AndrewH
Subject: Rendering to DC in virtual PC environment
Date Posted: 27 Jul 18 at 10:36AM
Using DebenuPDFLibraryDLL1411 with C++

We are print previewing the PDF and hence rendering the PDF to DC by calling:

DebenuPDFLibraryRenderPageToDC(int, double, int, HDC);

this works fine when running on your own PC using the graphics drivers on the PC.  However, when running our software in a virtual environment the image quality of the PDF is not anywhere near as clear and crisp.  Is there anything we can set call in the Debenu PDF Library that can resolve this?



Replies:
Posted By: tfrost
Date Posted: 27 Jul 18 at 12:17PM
What are you using to view the screen of the VM for the preview?  Remote Desktop?  VNC? Teamviewer?  Something else?  Is this remote software scaling the image, and have you experimented with adjusting this?  You could also try rendering to a PNG file with appropriate scaling and resolution and displaying that instead.


Posted By: Ingo
Date Posted: 27 Jul 18 at 8:56PM
Hi Andrew,

welcome here in the forum.
Perhaps the described behavior has to do with the settings of the vm?
The virtuell graphic memory could be too small.
Are the same dlls in the vm-system as in the real pc?
 


-------------
Cheers,
Ingo



Posted By: AndrewH
Date Posted: 30 Jul 18 at 8:47AM
Thanks for the replies, spoken to our systems admin and he says that it's not down to the VM's but RDP/Citrix.  If he RDP's to another PC they get the same problem!  He is adamant the problem is located in the print preview code.  

int quickPDF::RenderPageToDC(int pageNum, HDC hDC, double DPI)
{
int ret(0);

if (LibraryOK())
{
if (m_pDPL->SelectPage(pageNum))
{
m_pDPL->SetRenderDCErasePage(0);
ret = m_pDPL->RenderPageToDC(DPI, pageNum, hDC);
}
}

return (ret);
}

int DebenuPDFLibraryDLL1411::SelectPage(int PageNumber)
{
return DebenuPDFLibrarySelectPage(instanceID, PageNumber);
}

int DebenuPDFLibraryDLL1411::SetRenderDCErasePage(int NewErasePage)
{
return DebenuPDFLibrarySetRenderDCErasePage(instanceID, NewErasePage);
}

int DebenuPDFLibraryDLL1411::RenderPageToDC(double DPI, int Page, HDC DC)
{
return DebenuPDFLibraryRenderPageToDC(instanceID, DPI, Page, DC);
}


Posted By: tfrost
Date Posted: 30 Jul 18 at 11:11AM
What are you putting into DPI?  And does it match the VM's virtual DPI?  And does the virtual DPI change depending on how you log in to the VM? And how do you create the device context?  Have you used SetRenderScale?  The code you show is very unlikely to be the source of the problem. We render PDF to an image, as I said, and then display the image, making it as crisp and clear when viewed in a VM over RDP as it is when running and displaying on the local screen.  You should be able to mismatch the settings deliberately on your local machine and reproduce the problem there to prove that this is the cause.

However it occurs to me that since you are using C++, you may be limited to creating and using a device context when you come to displaying an image file anyway, so my suggestion would not help.  The advantage of Delphi is that the VCL and third party libraries give you complete control over image scaling and rendering.  If you use raw Windows device contexts you are subject to all sorts of influences which need to be taken into account and which may not be under your control.


Posted By: tfrost
Date Posted: 30 Jul 18 at 11:15AM
One other issue: is the OS the same in the VM as on the local machine and are the OS scaling settings the same?  Recent versions of Windows treat scaling differently and may require adjustments to your application manifest.


Posted By: AndrewH
Date Posted: 30 Jul 18 at 11:21AM
Creating a Print Preview DC, and yes we are calling SetRenderScale



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk