Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. [TestMethod]
  2. public void IdmlToSvg()
  3. {
  4.     //const string idmlFile = @"D:\SGE\w2p\card\file.idml";
  5.     const string idmlFile = @"D:\SGE\w2p\card\C108-F128-710-finance-insurance-business-cards-2-P.idml";
  6.  
  7.     using (var reader = new IdmlReader(idmlFile, 300, 300))
  8.     {
  9.         for (int i = 0; i < reader.Spreads.Count; i++)
  10.         {
  11.             var spread = reader.Spreads[i];
  12.             var frame = reader.Frames[i];
  13.  
  14.             using (var svgWriter = new SvgWriter($"D:\\SGE\\w2p\\card\\output\\{i}.svg", frame.Width, frame.Height, 300, 300))
  15.             {
  16.                 var svgGraphics = svgWriter.GetGraphics();
  17.                
  18.                 for (var ix = 0; ix < spread.Items.Count; ix++)
  19.                 {
  20.                     SpreadItem item = spread.Items[ix];
  21.  
  22.                     GraphicsContainer graphicContainer = item.GetItemContent();
  23.  
  24.                     svgGraphics.DrawContainer(graphicContainer, 0, 0);
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement