0

is there any way to combine two b5 size pdf into single legal size pdf. after googling i did not find any solution. how to approach this problem. what i can use to do it. i am developing c# desktop application which will combine two b5 size pdf to single legal page. one left size and another is right side

e.g. input

1. b5first.pdf  

   1234              

2. b5second 

   567     

Output should be

3. legal.pdf

   1234 567
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
navnit
  • 310
  • 3
  • 16

3 Answers3

0

You can get the text from the second pdf and put it in first, in the place you want to put. If you are using iTextsharp you can do something like

String text += PdfTextExtractor.GetTextFromPage(reader, pageno ,new LocationTextExtractionStrategy());

Then can put the string wherever you want.

Azrael
  • 1,094
  • 8
  • 19
M.S
  • 288
  • 4
  • 12
0

If you are looking for open-source solution then check this MetafileToEPSConverter to convert metafile into EPS and then convert EPS into PDF using epstopdf (included into LyX) or similar tools.

Eugene
  • 2,820
  • 19
  • 24
0
    public static void somefunction(string oldFile,string oldFile1,string pathout)
    {
        // open the reader
        PdfReader reader = new PdfReader(oldFile);
        PdfReader reader1 = new PdfReader(oldFile1);
        Document document = new Document(PageSize.LEGAL.Rotate());

        // open the writer
        FileStream fs = new FileStream(pathout, FileMode.Create, FileAccess.Write);
        PdfWriter writer = PdfWriter.GetInstance(document, fs);
        document.Open();

        // the pdf content
        PdfContentByte cb = writer.DirectContent;

        // create the new page and add it to the pdf
        PdfImportedPage page = writer.GetImportedPage(reader, 1);
        PdfImportedPage page1 = writer.GetImportedPage(reader1, 1);

        cb.AddTemplate(page, 0, 0);
        cb.AddTemplate(page1, 500, 0);
        // close the streams and voilá the file should be changed :)
        document.Close();
        fs.Close();
        writer.Close();
        reader.Close();
        reader1.Close();
    }
navnit
  • 310
  • 3
  • 16