For smart Primates & ROBOTS (oh and ALIENS ).

Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts

Thursday, April 23, 2015

html html5 to Pdf

Generate PDF file of html html5 with div span tags. It really works on liquid layout also!
Try it now!





html html5 to Pdf
Download here:

Part-1 
Part-2
Part-3
Part-4
Part-5
Part-6
Part-7
Part-8
Part-9
Part-10
Part-11

Extract  all files Part-1 to Part-11 and paste all files in one folder and double click on
Html-Html5-to-PDF.exe
Share:

Friday, March 13, 2015

MPDF not inserting image in pdf

You may face this problem while working with MPDF when you generate pdf file. this is due to mpdf is not accept full url of image.
for example this will no work:
"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCnfybluhgHSCRIheKE1OBIK11J0wE0xbBVKz5Wtni0_DBCUli5EzB9W_GTPcUSknpL7Yfg4xgngZbwg09rIvX-Fh7CvzWL5O3fIbIjQfbeQNNuyTgwfbHCtsAtUN9siO5_gMnqyXWMQY/s1600/video-watermark.jpg"

to overcome this problem you need to download that image in your server and use relative path while generating pdf. for example if your site name is : http://agalaxycode.blogspot.in/
then you need to create a folder "images" and save different name image from download  "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCnfybluhgHSCRIheKE1OBIK11J0wE0xbBVKz5Wtni0_DBCUli5EzB9W_GTPcUSknpL7Yfg4xgngZbwg09rIvX-Fh7CvzWL5O3fIbIjQfbeQNNuyTgwfbHCtsAtUN9siO5_gMnqyXWMQY/s1600/video-watermark.jpg". suppose you have downloaded and saved it with the name "aa.jpg" in "images" foler.
After that use this relative path in MPDF "images/aa.jpg".
MPDF uses relative path rather than absolute path
Share:

Thursday, March 12, 2015

PDF Water Marker

If you have a PDF with one page or more than one page and want to insert an image as a water mark in that PDF file then you can use this my software. Your are free to use this product.

PDF Water Marker














Before run this application you need to install .Net Framework 4.5

Download PDF Water Marker Here
Share:

Adding text in PDF File at specific position Freeware Software

Suppose you have a PDF file; which have one or more than one page and you want to insert text at the specific position. then in this situation you need to use PDF editor and goto each page and put the text at the position where you want. but if the pdf file is having 100 or more pages then it will difficult to edit it. in this condition you can use this my software.

If will make these task very easy, you need to input pdf file, text which you want to see and enter the X and Y position and click Apply button.


Adding text in PDF File at specific position Freeware Software

















It will insert the text at the position which you have supplied in all the pages. To execute this software you need to Microsoft Framework 4.0 or later.

Download Adding text in PDF File at specific position Software





Share:

Saturday, December 21, 2013

Html to pdf in java struts.

Html to pdf in java struts.


import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.PageSize;
import com.lowagie.text.html.simpleparser.HTMLWorker;
import com.lowagie.text.html.simpleparser.StyleSheet;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.codec.Base64;

import java.util.ArrayList;
import java.io.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServlet;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.apache.struts.validator.DynaValidatorForm;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import plugins.HibernateSessionFactory;


String contextName = request.getContextPath().substring(1);
HttpSession hs = request.getSession();
String path = hs.getServletContext().getRealPath("/" + contextName);

char pathSep = new File(path).separatorChar;

path = path.substring(0, path.lastIndexOf(pathSep + contextName));
path = path + pathSep + "MyForms";


Document pdfDoc = new Document(PageSize.A4, 50, 50, 1, 50);
Reader htmlReader = new BufferedReader(new InputStreamReader(new FileInputStream(path+"\\newRegistrn.html")));
ByteArrayOutputStream byteAOS = new ByteArrayOutputStream();
PdfWriter.getInstance(pdfDoc, byteAOS);
pdfDoc.open();
StyleSheet stylez = new StyleSheet();
stylez.loadTagStyle("body", "font", "Tahoma");
ArrayList arrayElementList = HTMLWorker.parseToList(htmlReader, stylez);
for (int i = 0; i < arrayElementList.size(); ++i) {
    Element e = (Element) arrayElementList.get(i);
    pdfDoc.add(e);
}
pdfDoc.close();
       
DateFormat dff = new SimpleDateFormat("dd_MMMM_yyyy");
DateFormat tf = new SimpleDateFormat("hhmmss");
String dateString = dff.format(new java.util.Date());
String timeString = tf.format(new java.util.Date());
String pdfStoredFileName = "\\newRegistrn_" + dateString + timeString + "__" + ".pdf";

byte[] byt = byteAOS.toByteArray();
String pdfBase64 = Base64.encodeBytes(byt);
File pdfFile = new File(path+pdfStoredFileName);
FileOutputStream out = new FileOutputStream(pdfFile);
out.write(byt);
out.close();
htmlReader.close();



String fileToDownload =pdfStoredFileName;
String disHeader = "Attachment;Filename=" + fileToDownload;
response.setHeader("Content-Disposition", disHeader);
File desktopFile = new File(path+pdfStoredFileName);
PrintWriter pw = response.getWriter();
FileInputStream fileInputStream = new FileInputStream(desktopFile);
int j;
pw.flush();
while ((j = fileInputStream.read()) != -1) {
   pw.write(j);
}
fileInputStream.close();
response.flushBuffer();
pw.flush();
pw.close();

File fileToDel = new File(path+pdfStoredFileName);
  if(fileToDel.delete()){
    System.out.println("\n "+fileToDel.getName() + " is deleted!");
  } else {
    System.out.println("\n Delete operation is failed.");
  }







Share:

Ads Inside Post

Powered by Blogger.

Archive