Hyperlinks not working in PrinceXML - php

If I write below code in html file to convert it to PDF with prince factory it is not working properly.
http://google.com
This above link in pdf generated from prince xml is working properly, but it is pointing to google.com instead of example.com
Google
This link will not work as we have not written anything before google as http or https.
Can someone please help me on this?
Thanks.

You can try with css model
Html
<span class="linkContent">
CSS
.linkContent {
content: "http://google.com"
}
Refer doc: https://www.princexml.com/doc/8.1/gen-content/
Hope it can help you!

hi you have to check the "prince-pdf-link-type" property.
by default value is auto, try to change to "web" :
https://www.princexml.com/doc/properties/prince-pdf-link-type/

Apologies for this. But the problem was not with PrinceXML. later after so much investigation, I found that it was problem with merging 2 documents in FPDF.
I used Zend Merger for merging 2 documents which were created by PrinceXML and it worked perfect.
Apologies and Thank you all for your help.

Related

Create PDF Laravel 5.5?

I want to create a pdf page from html file in Laravel but I do not know how to do it. You can help me
https://github.com/barryvdh/laravel-dompdf
// Import in top of controller file
use Barryvdh\DomPDF\Facade as PDF;
// use below code to generate and download pdf file
$pdf = PDF::loadView('bladefilename', ['arrayname' => $array]);
return $pdf->download('filename.pdf');
Write Above code in the controller file
In Blade file (HTML file) set array data.
Show Below Link : https://github.com/barryvdh/laravel-dompdf/issues/126
I know I am a little bit late but hopefully this will help someone.
There are 2 ways:
Create HTML page and use jspdf to print this page. The best way is to use html2pdf: https://github.com/eKoopmans/html2pdf.js
You can use this one to convert html to canvas and print to pdf. All css will be kept but you have to change the page to fix the space between pages as there may be some bad cut at the end of each page.
Print the page using latex. You have to use laravel latex compiler: https://github.com/fvhockney/latexcompiler
It is a little bit harder to styling the page but there is no problem with paging.

Php grab first image in page

Hey guys I'm wondering how I would be able to grab only the first image on a page. I want to echo it somewhere else possibly as a variable.
well I have not attempted this before, but I found a website that looks like it gives a pretty good solution. if you are trying to copy the first image from a URL. http://phpsnips.com/snippet.php?id=61
hope that helps. :)
You use PHP's DOMDocument class to grab the page's source, use an XPath query with DOMDocument to get the first img tag, then grab its src attribute.
http://php.net/manual/en/class.domdocument.php
You can then use that to save the url, or download the file.

How create text background in zend pdf

I am new to the zend-framework.
I created a pdf in zend and I want to set text background with the color.
like
please help........
Thanks in advance..
Please try to read : http://devzone.zend.com/article/12492
That will give answer to all of your doubts.......

How to convert HTML to PDF using PHP?

I want to convert HTML with Google Charts reports to PDF,I used fpdf and other classes but I didnt get success.
please help me .
You can try using HTML 2 PDF available from sourceforge here
You could also try dompdf

Outputting image using php GD library via function call

I know that I can output an image using GD by using
<img src='draw.php'>
Where draw.php is a file containing the code to create an image. How can I instead output the image via a function call (I am using the Zend Framework so will be using a View Helper) rather than simply pointing to a .php file in an img tag as above?
Any help greatly appreciated.
you can't.
at least not in a useable way - you could encode the image with base64:
<img src="data:image/png;base64,iVBORw0KGgoAAAANS..." alt=""/>
i don't have any idea which browsers support this, though ... quick test:
firefox: ok
chrome: ok
opera: ok
ie6: fail
ie7: fail
safari: fail
ok, forget it.
but, you're probably trying to do something different - passing the file through ZF. i can't help you with that, but it should work roughly like this:
in your controller, set the output type to image/png (however ZF handles that) pass through your image and make sure ZF doesn't add anything to the output (like additional html and stuff).
Why not make your View Helper create an image, write it to disk, and then output/return the img tag with the correct source attribute?
Send appropriate headers (content type) and then use http://www.php.net/image_jpeg

Categories