Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. string pastapdf = AppDomain.CurrentDomain.BaseDirectory + "temporario\" + Path.GetFileNameWithoutExtension(e[i]);
  2. Directory.CreateDirectory(pastapdf);
  3. string pdfFile = Path.Combine(pastapdf, e[i]);
  4. for (int h = 0; h <= (pdfReader.NumberOfPages - 1); h++)
  5. {
  6. using (var document = PdfiumViewer.PdfDocument.Load(pdfFile))
  7. {
  8. var image = document.Render(h, dpi, dpi, true);
  9. image.Save(pastapdf + "\" + Path.GetFileNameWithoutExtension(e[i]) + "_" + h.ToString() + ".tif", ImageFormat.Tiff);
  10. image.Dispose();
  11. }
  12. }
  13. string save = output + "\" + Path.GetFileNameWithoutExtension(e[i]) + ".tif";
  14. string[] tifffiles = GetFiles(pastapdf, "*.tif");
  15. var finalfiles = tifffiles.OrderBy(f =>
  16. new string(f.Where(char.IsLetter).ToArray())).ThenBy(f => {
  17. int number; if (int.TryParse(new string(f.Where(char.IsDigit).ToArray()), out number))
  18. return number; return -1; } ).ToList(); //código LINQ para ordenar
  19.  
  20. JoinTiffLZW(finalfiles.ToArray(), save);
  21. Invoke(new Action(() => { pbar.PerformStep(); pdfReader.Dispose(); }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement