I'm using a Django wrapper with wkhtmltopdf however I'm having the problem that regardless of the fonts I use in my CSS it always just shows a default sans-serif font. It works locally and also works on the server when I just generate the HTML without converting it to the PDF.
This is how it shows on the server in the PDF and this is how it shows locally in the PDF. The font is a custom font base64 encoded, however it doesn't matter what font I use as none make a difference.
Is it something to do with the server setup?
Anyone have any ideas?
Thanks in advance.
What's the css you're applying to the text? wkhtmltopdf has some quirks, and apparently doesn't like fallbacks (link). I was observing something similar and finally got a serif font (closest I could get to Times New Roman w/o downloading) by doing
font-family: "serif";
wkhtmltopdf only includes fonts if it finds them in the local system in /usr/share/fonts
If you use fonts like font-family: 'Liberation Sans'; ,wkhtmltopdf will correctly include them in the PDF and render them as it should.
If someone is still looking for a solution (in the current version of wkHTMLtoPDF). The solutions above didn´t solve my problem.
For me the correct solution was to add an svg-font for each font (font-type). wkHTMLtoPDF takes at least the svg. In my case, it always took the fallback font (Arial). I just converted each font and added it to my font.scss.
I hope this helps.
Related
I'm following this guide on editing imported svg's in draw.io but with no luck. I am not getting the style options after inserting the editableCssRules=.*; code on the svg itself.
Has anyone else experienced this? I have the latest version installed and have restarted my machine.
I'm expecting to see additional Fill options as the guide suggests.
If possible, please attach SVG image and add the whole SVG code (Ctrl+e) with inserted editableCssRules=.*; so I can see all the details.
Thanks,
Same problem here.
Here is the whole SVG code as requested :
editableCssRules=.*;aspect=fixed;html=1;points=[];align=center;image;fontSize=12;image=img/lib/azure2/general/File.svg;imageBackground=default;sketch=0;
The option editableCssRules just does what it says: it makes the specified CSS classes editables; in your case by using editableCssRules=.*; you are using a Regex expression to make all CSS classes in the SVG editable.
You are not seeing any options appear after modifying the style because with all probability the SVG you are using does not contain any CSS classes.
You will need to edit your SVG file and add the CSS classes that you need and refer to them in the paths, like so:
<style type="text/css">
.st0{fill:#000000;}
</style>
<path class="st0" d="YOUR_PATH_HERE"/>
Now, in draw.io import the SVG again and after adding the editableCssRules=.*; option to the style you should be able to edit its color, like so:
I've tried loading a local html file using webkit_web_view_load_uri() with a file:// URL. However, the webview would display a blank page. To circumvent this, I tried using webkit_web_view_load_html() and it worked correctly.
Now that I'm trying to load some images in the html using the <img> tag, the images aren't loaded (It displays a blank page).
I'm puzzled because I tried before (~ 2 months ago) a similar method and it worked.
Note: I copied the contents of the generated HTML into a file and loaded it with Firefox and it worked as it should (The images are visible), but with another WebKitGtk application I had lying around the images didn't load.
Note: I'm using C++ as the main programming language (I'd prefer having C++ types in the solutions only if possible)
Note: I have set webkit_settings_set_allow_file_access_from_file_urls() and webkit_settings_set_allow_universal_access_from_file_urls() to TRUE
Ok, I've managed to solve this. The solution had NOTHING to do with webkitgtk, which is strange. It seems that the application was trying to download the page instead of loading it. This traces to a faulty MIME type database.
Tl;Dr:
Execute this:
rm ~/.local/share/mime/packages/user-extension-html.xml
update-mime-database ~/.local/share/mime
and use webkit_web_view_load_uri() instead of webkit_web_view_load_html() with a file:// URI
I had the same problem in C. You have to explicitly set file:// as base_uri when you call webkit_web_view_load_html().
See also answer here
I use Aspose.Cells for java to convert excel documents to html. But there is problem with umlauts.
there is the code I use to save excel documents to html
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(stream);
workbook.save(path, com.aspose.cells.SaveFormat.HTML);
is there some way to resolve this?
This type of issues might occur due to missing fonts. Since Aspose.Cells needs the underlying fonts (used in the workbook) to be installed on the system for rendering to PDF, HTML or image, so you got to make sure all the underlying fonts are there on the pc and your application should access to that folder. You can also find the needed fonts for your workbook using Workbook.getFonts() method. You may put all the font files (.ttf files) in some folder and set the fonts directory at the start before using your original code.
e.g
Sample code:
......
String MyFontDir = "your_fonts_folder_path";
// Setting the fonts folder with setFontFolder method
FontConfigs.setFontFolder(MyFontDir, true);
//.......
//Your code goes here.
//......
I am working as Support developer/ Evangelist at Aspose.
I am trying to use primefaces advanced fileupload, however I have noticed that when the extension is in uppercase the preview does not work. Below is the upload code.
<p:fileUpload fileUploadListener="${myController.handleFileUpload}"
mode="advanced" id="fileupload"
sizeLimit="2000000" uploadLabel="Add"
dragDropSupport="false" previewWidth="190"
label="Browse" style="width: 600px;height: 200px"
required="true" update="fileDescId"
allowTypes="/(\.|\/)(gif|jpe?g|png|GIF|JPG|JPEG|PNG)$/i"/>
Searching on google has not yielded much, I found that adding /i at the end of allowTypes makes the regex case insensitive but still the preview does not show. If I click upload it upload successfully even if the preview did not show, but I need the preview because a description of the image is required.
I figured out your problem. The problem in the file \META-INF\resources\primefaces\fileupload\fileupload.js. Preview images are only available for png, jpg and gif files and for this there is a check:
//preview
if($this.isCanvasSupported() && window.File && window.FileReader && $this.IMAGE_TYPES.test(file.name))
and pattern:
IMAGE_TYPES: /(\.|\/)(gif|jpe?g|png)$/
As you can see in this place lacks the flag for case insensitive validation. So i manually add this flag
IMAGE_TYPES: /(\.|\/)(gif|jpe?g|png)$/i
and preview started working as it should. I checked several times, cleaned and put the flag, everything works.
So I sent the corresponding patch.
In coldfusion 8, I used bellow code to view "UserDesc"field data from database table that is working on well IE and chrome but not on Firefox. On firefox it does not display on fckeditor,but shows on textarea. please suggest any change in code.
<cfmodule
template="fckeditor/fckeditor.cfm"
basePath="../views/fckeditor/"
instanceName="Question"
value='#UrlDecode(UserDesc)#'
width="530"
height="260">
There are a few newer ways to use the ckeditor in Coldfusion. You can just use the following (this may be cf9+ only, i'm not sure):
<cftextarea name="Question" id="Question"
richtext="yes"
value="#UrlDecode(UserDesc)#">
</cftextarea>
Or you could just use the javascript one as demo'd here (this should work for any version of coldfusion): http://ckeditor.com/demo You would just have to put your value in between the opening and closing text area tags.