Yes, the same code. We're on a bit of an older version of JsReport due to other dependencies in the code base. Do you think that's a factor ?
Posts made by anassri
-
RE: Chrome-pdf scaling down content issue
-
RE: External images broken in chrome-pdf
The images we are using are routed through an internal web server. Since JsReport uses headless chrome, the requests from the local server were getting blocked by our company's firewall since they were unidentified. Once we push to production, the images should show up. Check to see if you have a firewall blocking your images requested through a local headless chrome
-
RE: Chrome-pdf scaling down content issue
I commented out all the external stylesheets but the one needed by the template. Now the code looks like the one in the playground, but I'm still getting the same scaled-down results. Not sure what's going on. Is there a setting that I can pass to chrome to prevent it from scaling down content?
-
RE: Chrome-pdf scaling down content issue
It looks fine in the studio, but we're not using the studio. We're using handlebars straight in node, which gives me the results in that screenshot after calling jsreport with the rendered html.
Here's the playground link:
-
Chrome-pdf scaling down content issue
Hello,
I'm trying to format a bunch of products to fit in a 2x2 grid that takes up the whole page.
I have set the chrome options to the following
chrome: { marginRight: '.5in', displayHeaderFooter: true, format: 'Letter', marginBottom: '.5in', waitForNetworkIddle: true, marginTop: '.5in', headerTemplate: '\u003cdiv\u003e\u003c/div\u003e', marginLeft: '.5in', footerTemplate, preferCSSPageSize: true }
and set the @page size as follows
@page { size: 850px 1100px; }
My issue is that chrome-pdf is still scaling down content leaving lots of empty spaces around the grid. Here's a screenshot
Any ideas how I can prevent chrome-pdf from scaling down my content?
Thanks!
-
Error with render
Hello, I'm seeing this error when hit the endpoint:
TypeError: jsreport_1.default.render is not a function
this is how I'm calling the render function:
export const convertTemplateToPdf = async (template: string): Promise<JsReportRenderResult> => { const templatePdf: JsReportRenderResult = await jsreport.render({ template: { engine: 'none', recipe: 'chrome-pdf', content: template } }); return templatePdf; };
This is the import statement
import jsreport from 'jsreport';
and this is my package.json dependencies
"dependencies": { "@jsreport/jsreport-freeze": "^3.0.1", "express": "^4.19.2", "jsreport": "^3.13.0", "express-handlebars": "^6.0.7", "pdf-merger-js": "^4.1.0" }
Any thoughts on why I'm getting that error?
Thanks!
-
Trouble accessing local files
Hello there,
I'm trying to access local files using a handlebars template. I'm able to compile the template and render it in Express. When I try to convert that rendered HTML into a PDF using jsreport programmatically. I get the following error in the console:
Page request failed: GET (stylesheet) file:///styles/cover.css, failure: net::ERR_FILE_NOT_FOUND
Here's how I'm linking the stylesheet:
<link rel='stylesheet' href='/styles/cover.css' />
I'm trying to use jsreport programmatically without the studio. So I can't use jsreport syntax as compiling handlebars in Express won't understand it. Handlebars is able to find the local files and they render in HTML just fine. JsReport didn't have access to local files at first, but then I turned "allowLocalFileAccess
" on, and it's not able to find them. Is there a way I can instruct jsreport where to look similar to
app.use(express.static(__dirname + '/views')) ?Thanks
-
RE: External images broken in chrome-pdf
Is there a way to set a custom user-agent in JsReport?
-
RE: External images broken in chrome-pdf
It's routed through our server. Do you think that server is blocking access to it?
-
RE: External images broken in chrome-pdf
Is there a way to add cloudinary credentials to jsreport's studio? Perhaps that might work
-
RE: External images broken in chrome-pdf
I'm going to see if Cloudinary is preventing access. We have a lot of images that we're using to create a report with, so if they're blocking the tool, we will need to have them allow it for all the images. Thanks for the response!
-
External images broken in chrome-pdf
Hello, Any idea why I'm getting a 403 when using image URLs? I'm using Cloudinary to host my images. Is it a cloudinary access issue? I'm able to get the images to show if I switch the recipe from chrome-pdf to html-to-browser-client
Playground: https://playground.jsreport.net/w/anon/vVA6ndvZ
Thanks in advance for the help!