React pdf generator with transform, scale, rotate and more - reactjs

I'm testing and looking forward into some solutions like react-pdf and others. But what I really need is to use css properties like transform, translate and more like scale and rotate for example.
Do You heard about som kinda solutions, maybe someone just used something like?
I'll be grateful for any advice.

For all future searcher:
I tried react-pdf and html-pdf, but they were not solutions that would suit me completely.
There was always a lack of either transition, transform or svg support. In addition, they required writing an additional pdf template from which to generate.
So, ultimately, I used a node library called Puppeteer, based on chromium, thanks to which you can generate a pdf just like in the preview on the chrome browser, and regardless of which browser we use.
Puppeter is in fact a Headless Chrome ('running Chrome without chrome') solution, which enters the address we want and performs actions without the participation of the user, in this case writing to a pdf file.
Link: [https://pptr.dev/]
Link: Headless Chrome

Related

can i scale a react component like an SVG

i have a website where i had a pdf preview as a react component, the pdf should be in real dimension, all works smooth until I start working on making the website responsive, I didn't know wt to do exactly with the pdf preview, I have an idea to scale the whole component up and down like we do with an SVG but idk if that's possible to do
I think you better use a library to preview the PDF.Since you want to make it responsive without affecting the preview.You may make use of libraries like react-pdf. This library may generate PDF files from a URL, a local file within the project, or a base64 encoded version.
And i found this article useful.
Hope this may help you!
And as you have mentioned you have some troubles installing react-pdf it's not very compatible with webpack5that is mostly due to Buffer dependency.
Refer to thsi :react-pdf issues
Without knowing the exact error, it's so difficult to help, so be more specific when you are asking questions.

Does LayoutAnimation Work Under Any Circumstances?

LayoutAnimation is a part of React Native that automatically animates components when the view is rendered.
The official documentation is here:
https://reactnative.dev/docs/layoutanimation
However, the examples in the docs do not work. Objects in the examples that are supposed to animate just jump from the starting position to the end position.
Here is an example of one of the Snacks in the documentation that does not appear to animate:
https://snack.expo.io/91MUQd5IH
This would lead one to the conclusion that this API is just not supported or no longer functional.
Is it the case that Layout Animation just does not work? Or if it does work under some circumstances, please share a link containing a working Snack / Gist with an extremely simple but working LayoutAnimation example.
UPDATE: LayoutAnimation possibly does not support web. Does anyone have any knowledge of this or who can refer the reader to an explanation in the docs?
LayoutAnimation is currently not supported properly in react-native-web. You can see that here: https://github.com/necolas/react-native-web#modules and here https://github.com/necolas/react-native-web/issues/1613, https://github.com/necolas/react-native-web/issues/1056. It doesn't seem to be a priority for the project at the moment so I wouldn't count on it being implemented.
On iOS/Android it's a different story. If we look here: https://reactnative.dev/docs/layoutanimation/ you can actually see this working properly by pressing play and selecting iOS for example.
On Android we have support as well but it might not work/crash. If you look over the issues open for react-native, you will see a lot of them mention issues with LayoutAnimation and Android. E.g. it crashes under certain conditions on Android: https://github.com/facebook/react-native/issues/27552 and https://github.com/facebook/react-native/issues/29919.
I don't recommend using LayoutAnimation, especially on Android, as it is highly experimental and might crash on some devices without warning.
If you want to try some more interesting animations with better performance, I recommend you try using the Animated API from ReactNative or the newer react-native-reanimated which is faster, more modern but still in alpha (I'm talking about the current, v2, version).
By my test the given link in the question post works properly:
Also, I test it on my friend's iPhone and it's worked properly too. But many of React Native features don't work properly on Web export. For example animations on RNW (React Native Web) works on Android/iOS exports but not on Web exports.
For such web situations, you should decouple the web component and make a separate file then write the desired animation on it.

How to create a living style guide with your own UI

I have created an website/application using Angular2. The infrastructure is all set, I have routing completed, sass being processed etc.
I have sections (components) on this website that will display current web standards for our designs (buttons, forms, copy). The purpose of this site is to give our developers a copy/paste solution for markup and sass.
We will most likely create our own css library but they will still need a good visual reference of what each class does and a copy/paste solution.
I know how to develop all the standards, what I don't know how to do is have the DOM display options for the user to copy/paste the code. I could manually enter the code into or tags but this will be hard to maintain and not very clean approach. I'd like to find some solution that will utilize my code and create these tags at run time.
Googling this question leads down the road of using living style guide generators, which i don't want to use... why? I like having the functionality of controlling my own layout and scaling my standards as I see fit with our own technology.
Any ideas?
After exploring this even further I ended circling yet again on documentation tools (KSS) where I would need to rebuild my entire style guide for this functionality using markdown and or JDOCs.
Solution!
Use CodePen, its free to signup however there are some nice to have features for a monthly fee. I easily created my code here using SASS, HTML and CSS libraries. CodePen has a great EMBED feature whereas I could copy/paste html or iframe right to my styleguide.
Problem is now solved, and we have have a dynamic Web & UI Styleguide.
Hope this method helps others in my situation.

Anyone know why my .mp4 video won't load using lightbox?

I am trying to use lightbox to display my video and instead of the video showing I am just getting a loading icon that never stops. I can put an image in place of the video and it works fine. Here is my code:
<img src="images/video_icon.png" height="240px" width="240px" id="middle_circle" class="circle">
As I said, using an image in the href instead of a video works fine so the CSS and JS is linked properly. Also, the video itself loads fine without the lightbox so it's not the video's fault either.
I wasn't able to find any examples for video so I am not sure if there is something different I need to do and was unable to find the solution elsewhere, including on here.
Currently Lightbox2 doesn't support videos by default at all, and it seems the maintainer doesn't plan on adding video support either. You can always edit Lightbox2 to allow video support provided you have the Javascript/JQuery experience.
If you're using Drupal CMS, they have a custom version of Lightbox2 that supports video content. https://www.drupal.org/node/252276
Your best bet is probably finding another Lightbox that can support your needs.
As answered above it don't supported playing Video.
But you can use some like - http://dimsemenov.com/plugins/magnific-popup/ - very nice & customizable ligtbox.

Conditional statements in HTML to rule out non-mobile devices

well i've made a responsive website which handles well in mobile devices. Now there are some Phonenumbers on the website which my cliƫnt would like to be clickable on any Phone so the visitor can call directly. I found that making a link of the phonenumbers works like so:
make a call
This triggers mobilephones to call the number. But it also triggers the webbrowser on any other device to follow the link, which results in "page can't be found"
I'm looking for a good anwser to tackle this problem. I've been searching for a while now but i'm getting a bit tired and frustrated.
I think i've come with a solution but i don't excactly know how to put this in the html.
There are several ways to conditional comment browsers in html. If i could do this with the link part and rule it out:
<!--[if any **none mobile** webrowsers: don't read:]>003164646464
And all mobile browsers read the link.
It seems to me, that this is the most easy way to do this, but i could be wrong...
I hope that someone can give me any pointers, I really appreciate your idea's and help!
THANKS!
There is no easy way to achieve this. You can use different approaches depending how accurate you want to be:
WURFL - most accurate, allows to check user-agent and get browser / device capabilities
You can try parsing user-agent by your own detecting OS - check this answer Detecting a mobile browser
Use css media queries to target devices with small screen
Unfortunately there is no silver bullet for this (at least I don't know one).

Resources