Force Export PDF to Always Export in Desktop Layout

1 Answer 69 Views
PDF Processing PDF Viewer Styling / Themes Window
Procurement
Top achievements
Rank 1
Procurement asked on 16 Feb 2023, 01:48 PM

We are trying to export the pdf from mobile browser, we are getting the same view in the pdf which is expected. We wants to export the pdf always to be in the desktop layout irrespective of the device from where it is exported.

 

In this format we want when we will export the pdf from mobile

 

but we are getting this

 

Is there any options already provide to the PDFExport. or any other way to achieve this.

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 20 Feb 2023, 12:04 PM

Hi,

A possible solution would be to set the required height and width of the div container.

I made an example that showcases this approach here:

https://stackblitz.com/edit/react-w4tvzc-jv93jk?file=app/main.jsx

I tested it and It seems that no matter the screen size, with this approach the components will be exported with the defined width and height.

I hope this helps.

Regards,
Filip
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Procurement
Top achievements
Rank 1
commented on 21 Feb 2023, 12:42 PM

Hi Filip,

Thank you for your response.

I am having some media queries for different view in different resolutions. But Irrespective of resolutions I want to get the single view 

in pdf even if I exports it from different resolutions screen.

 

example

 

I want to apply media query in web view but not for pdf.

 

Can you please help me with this. How can I manipulate screen size??


Filip
Telerik team
commented on 23 Feb 2023, 09:36 AM

Hello, 

The previously suggested approach should export the components in the specified dimension, regardless of the screen size when it is exported.

If the requirement is to set the styles for the component itself rather than the exported pdf view, this has to be done by setting the styles in the required media queries as you are doing.

In order to assist further, can you modify the previously sent stackblitz example to reproduce the issue you are encoutering so that I can investigate further why the media querries are not taking effect?

Procurement
Top achievements
Rank 1
commented on 23 Feb 2023, 01:04 PM | edited

Hi Filip,

I have updated the code in the stackblitz. Can you please check it once.

Filip
Telerik team
commented on 27 Feb 2023, 11:41 AM

Hello,

I inspected the previously sent stackblitz example, however, when I tested it in mobile view and exported the page content, the size of the components is that of the big screen with the defined width and the code is the same.

I assume that your changes to the example were not saved, can you try to fork the example, modify it and then send the URL via the Share button so that I can inspect it?

Regards,
Filip

Tags
PDF Processing PDF Viewer Styling / Themes Window
Asked by
Procurement
Top achievements
Rank 1
Answers by
Filip
Telerik team
Share this question
or