Can I show a PDF inside a DIV with a zoom function? - pdf

I have a large PDF and I need to show it 50% reduced in size inside a div tag that is 600px 600px in size. I also need to offer the client a zoom function.
Should I use the "object" tag? But can I reduce the pdf size inside an "object"?
Is there a jquery example or anything out there?
Need help.

<div>
<object data="febrero2012.pdf" type="application/pdf" width="600px" height="600px">
alt : febrero2012.pdf
</object>
</div >
I coudn't find the way to set a default zoom level yet. If you find a way, please let me know.

No. PDFs cannot be displayed in a DIV, as they're not html or an image. You can convert the PDF to html/images on the server and display that, just like google's "quick view" function does. But in general, PDF rendering in-browser is dependent on the presence of a plugin (e.g. Adobe Reader, Chrome's built-in rendering engine notwithstanding). Plugins can't be displayed in divs, just embed/object/iframe sections.

Related

Printing PDFs with Puppeteer/Playwright and Flexbox Layouts

If you open Chrome or Edge and visit a page with a flexbox layout, like this one, and choose Print/Save as PDF, the PDF includes the flex elements in the proper location. However, if you use Playwright and the Page object's pdf() method, flex elements are missing.
I'm fairly certain this isn't a bug with Playwright, or Puppeteer, but instead is an issue with how the headless chromium creates the pdf. Or, hopefully, it's some kind of option I'm missing somewhere. Does anyone have experience creating PDFs of pages with flexbox layouts using Playwright?
I had a similar issue where the height of the elements inside my flexbox was completely wrong in Puppeteer.
I was able to solve it by using display: inline-flex instead of display: flex

Webflow - logo image turns into to grayscale while the element and all parent elements have this Effect set to off

I'm very new to Webflow. I am somewhat familiar with CSS and web design concepts.
I downloaded one of the clonable templates to use as a practice:
https://webflow.com/made-in-webflow/website/Spaces-Urbanistic
With this template, I try to replace the logo image on the upper left.
I have a colorful webpage logo and inside the designer, I see all the colors.
When I click on preview, the logo turns into a grayscale image.
Webflow has Effects option that I could enable, but it is currently set to off, for Logo image element as well as all parent nodes up to the body tag.
When I inspect the logo in chrome dev tools, the immediate parent has this CSS:
element.style {
filter: invert(100%)
grayscale(100%)
contrast(128%);
}
My question is, where do those filter parameters are stored in webflow interface, if not under Style->Effects->Filters? Is there any other place I don't yet know about where the above code can be injected?
Thank you,
edit-1: I just noticed this code on top of the main HTML file:
Still, doesn't help me to identify where this code comes from. Thank you,

SVG with images with dataURL href not rendered correctly in some engine

This SVG originated from HTML5 canvas. Which looks fine and I added images that are represented in dataurl form to avoid CORS issues.
However, when opened in chrome the image showed up fine
When opened in Adobe Illustrator, the image did not show up.
When opened with macOS preview app, the image did not show up.
I looked up SVG2 specifications for using dataURL in svg's <image> tag href attribute and they said its okay to use. So I don't understand what is causing this rendering discrepancy between different viewers.
File for reference
In short, what is the standard way to embed images into SVG.
Okay I found out it is because only Chrome supports the newer SVG2 standard href attribute on <image> element of SVG. So I just needed to replace the href with xlink:href
Even though xlink:href attribute is deprecated in SVG2. It seems the other softwares aforementioned in the question are not SVG2-compliant.

Add timestamp watermark to PhantomJS images

How can I add watermarks on Phantomjs images?
Somewhat like this:
Can page.evaluate help me here?
Any injection or while rendering should not affect the actual look of the webpage. This stamp should only overlay.
The rendering is very high level in PhantomJS. The only way is to inject the watermark as an element (think position: absolute) into the DOM through page.evaluate and remove it after the screenshot.
Finally got it.
Created a new html element which is required, from DOM method and then injected this while rendering the HTML by page.evaluate.

Flash object not loading in Safari

I've built a form, and next to my form element I've placed a flash object. When the page is loaded, the form is display: block, and the flash object is display: none.
The layout looks something like (the img is there so that if the user doesn't have flash, the gif animation will play instead):
<form id="form"></form>
<div id="upload-anim-div">
<object type="application/x-shockwave-flash"
data="<?= PAL_STATIC_HOST ?>/music/introducing/flash/upload_animation.swf"
width="626"
height="600">
<param name="movie" value="<?= PAL_STATIC_HOST ?>/music/introducing/flash/upload_animation.swf"/>
<img src="<?= PAL_STATIC_HOST ?>/music/introducing/img/Anim-placeholder.gif" alt="upload animation (gif)"/>
</object>
</div>
When I submit my form, which is just to upload a file, I hide the form and display my animation div as follows in javascript:
$('#form').hide();
$('#upload-anim-div').show();
This works great in all browsers except Safari, where a big white space appears. Right clicking this white space simply gives me the following menu:
Flash movie not loaded... _not clickable_
About Adobe Flash Player 10.5.blah...
Why is the movie not loaded/loading?! If I simply display the movie when the document first loads (by removing the javascript line that initially hides it) it loads and displays fine! Any ideas would be greatly appreciated!
---EDIT---
I've now tried using swfobject, but get exactly the same problem. I used this kind of code in my javascript to embed my swf with javascript after displaying the upload-anim-div:
swfobject.embedSWF("myContent.swf", "upload-anim-div", "626", "600", "10");
Anyone have any further ideas?
Sounds like Safari tries to shave the page load time by not rendering Flash in a hidden div. How are you putting the Flash into the div, is it just an object tag, or are you using something like swfobject? If you're using swfobject you could write the Flash to the div when you reveal it.
I think you should try to embed your Flash content with swfobject: