BVB Source Codes

PDF file browser Show Filtering.cs Source code

Return Download PDF file browser: download Filtering.cs Source code - Download PDF file browser Source code - Type:.cs
  1. //
  2. // PDFsharp - A library for processing PDF
  3. //
  4. // Authors:
  5. //   Stefan Lange (mailto:Stefan.Lange@pdfsharp.com)
  6. //
  7. // Copyright (c) 2005 empira Software GmbH, Cologne (Germany)
  8. //
  9. // http://www.pdfsharp.com
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29.  
  30. using System;
  31. using System.Diagnostics;
  32. using PdfSharp.Internal;
  33. using PdfSharp.Pdf.IO;
  34. using PdfSharp.Pdf.Internal;
  35.  
  36. namespace PdfSharp.Pdf.Filters
  37. {
  38.   /// <summary>
  39.   /// Applies standard filters to streams.
  40.   /// </summary>
  41.   internal class Filtering
  42.   {
  43.     // Make class static
  44.     Filtering()
  45.     {
  46.     }
  47.  
  48.     /// <summary>
  49.     /// Gets the filter specified by the case sensitive name.
  50.     /// </summary>
  51.     public static Filter GetFilter(string filterName)
  52.     {
  53.       switch (filterName)
  54.       {
  55.         case "ASCIIHexDecode":
  56.           if (Filtering.asciiHexDecode == null)
  57.             Filtering.asciiHexDecode = new ASCIIHexDecode();
  58.           return Filtering.asciiHexDecode;
  59.  
  60.         case "ASCII85Decode":
  61.           if (Filtering.ascii85Decode == null)
  62.             Filtering.ascii85Decode = new ASCII85Decode();
  63.           return Filtering.ascii85Decode;
  64.  
  65.           //case "LZWDecode":
  66.           //  if (Filtering.lzwDecode == null)
  67.           //    Filtering.lzwDecode = new LZWDecode();
  68.           //  return Filtering.lzwDecode;
  69.  
  70.         case "FlateDecode":
  71.           if (Filtering.flateDecode == null)
  72.             Filtering.flateDecode = new FlateDecode();
  73.           return Filtering.flateDecode;
  74.  
  75.           //case "RunLengthDecode":
  76.           //  if (Filtering.RunLengthDecode == null)
  77.           //    Filtering.RunLengthDecode = new RunLengthDecode();
  78.           //  return Filtering.RunLengthDecode;
  79.           //
  80.           //case "CCITTFaxDecode":
  81.           //  if (Filtering.CCITTFaxDecode == null)
  82.           //    Filtering.CCITTFaxDecode = new CCITTFaxDecode();
  83.           //  return Filtering.CCITTFaxDecode;
  84.           //
  85.           //case "JBIG2Decode":
  86.           //  if (Filtering.JBIG2Decode == null)
  87.           //    Filtering.JBIG2Decode = new JBIG2Decode();
  88.           //  return Filtering.JBIG2Decode;
  89.           //
  90.           //case "DCTDecode":
  91.           //  if (Filtering.DCTDecode == null)
  92.           //    Filtering.DCTDecode = new DCTDecode();
  93.           //  return Filtering.DCTDecode;
  94.           //
  95.           //case "JPXDecode":
  96.           //  if (Filtering.JPXDecode == null)
  97.           //    Filtering.JPXDecode = new JPXDecode();
  98.           //  return Filtering.JPXDecode;
  99.           //
  100.           //case "Crypt":
  101.           //  if (Filtering.Crypt == null)
  102.           //    Filtering.Crypt = new Crypt();
  103.           //  return Filtering.Crypt;
  104.  
  105.  
  106.         case "LZWDecode":
  107.         case "RunLengthDecode":
  108.         case "CCITTFaxDecode":
  109.         case "JBIG2Decode":
  110.         case "DCTDecode":
  111.         case "JPXDecode":
  112.         case "Crypt":
  113.           return null;
  114.       }
  115.       throw new NotImplementedException("Unknown filter: " + filterName);
  116.     }
  117.  
  118.     /// <summary>
  119.     /// Gets the filter singleton.
  120.     /// </summary>
  121.     public static ASCIIHexDecode ASCIIHexDecode
  122.     {
  123.       get
  124.       {
  125.         if (Filtering.asciiHexDecode == null)
  126.           Filtering.asciiHexDecode = new ASCIIHexDecode();
  127.         return Filtering.asciiHexDecode;
  128.       }
  129.     }
  130.     static ASCIIHexDecode asciiHexDecode;
  131.  
  132.     /// <summary>
  133.     /// Gets the filter singleton.
  134.     /// </summary>
  135.     public static ASCII85Decode ASCII85Decode
  136.     {
  137.       get
  138.       {
  139.         if (Filtering.ascii85Decode == null)
  140.           Filtering.ascii85Decode = new ASCII85Decode();
  141.         return Filtering.ascii85Decode;
  142.       }
  143.     }
  144.     static ASCII85Decode ascii85Decode;
  145.  
  146.     //lzwDecode
  147.    
  148.     /// <summary>
  149.     /// Gets the filter singleton.
  150.     /// </summary>
  151.     public static FlateDecode FlateDecode
  152.     {
  153.       get
  154.       {
  155.         if (Filtering.flateDecode == null)
  156.           Filtering.flateDecode = new FlateDecode();
  157.         return Filtering.flateDecode;
  158.       }
  159.     }
  160.     static FlateDecode flateDecode;
  161.  
  162.     //runLengthDecode
  163.     //ccittFaxDecode
  164.     //jbig2Decode
  165.     //dctDecode
  166.     //jpxDecode
  167.     //crypt
  168.  
  169.     /// <summary>
  170.     /// Encodes the data with the specified filter.
  171.     /// </summary>
  172.     public static byte[] Encode(byte[] data, string filterName)
  173.     {
  174.       Filter filter = GetFilter(filterName);
  175.       if (filter != null)
  176.         return filter.Encode(data);
  177.       return null;
  178.     }
  179.  
  180.     /// <summary>
  181.     /// Encodes a raw string with the specified filter.
  182.     /// </summary>
  183.     public static byte[] Encode(string rawString, string filterName)
  184.     {
  185.       Filter filter = GetFilter(filterName);
  186.       if (filter != null)
  187.         return filter.Encode(rawString);
  188.       return null;
  189.     }
  190.  
  191.     /// <summary>
  192.     /// Decodes the data with the specified filter.
  193.     /// </summary>
  194.     public static byte[] Decode(byte[] data, string filterName, FilterParms parms)
  195.     {
  196.       Filter filter = GetFilter(filterName);
  197.       if (filter != null)
  198.         return filter.Decode(data, parms);
  199.       return null;
  200.     }
  201.  
  202.     public static byte[] Decode(byte[] data, string filterName)
  203.     {
  204.       Filter filter = GetFilter(filterName);
  205.       if (filter != null)
  206.         return filter.Decode(data, null);
  207.       return null;
  208.     }
  209.  
  210.     /// <summary>
  211.     /// Decodes to a raw string with the specified filter.
  212.     /// </summary>
  213.     public static string DecodeToString(byte[] data, string filterName, FilterParms parms)
  214.     {
  215.       Filter filter = GetFilter(filterName);
  216.       if (filter != null)
  217.         return filter.DecodeToString(data, parms);
  218.       return null;
  219.     }
  220.  
  221.     public static string DecodeToString(byte[] data, string filterName)
  222.     {
  223.       Filter filter = GetFilter(filterName);
  224.       if (filter != null)
  225.         return filter.DecodeToString(data, null);
  226.       return null;
  227.     }
  228.   }
  229. }
  230.  
downloadFiltering.cs Source code - Download PDF file browser Source code
Related Source Codes/Software:
Campus id - This system includes a campus dormitory management... 2015-04-10
ShopXP online system source code - ShopXP ShoppingNet online system source code infor... 2015-04-10
TOM cat demo in learning to speak - 实现汤米猫学说话的演示,即实现变声功能鲜豔,,,,,,,开发者说:自己经常来看code4app,看看... 2015-04-10
Another OpenFolder - Implements can commence in the middle of the scree... 2015-04-10
Bus query system - A simple bus query system. Can be divided into rou... 2015-04-10
Customer service management system - To a store and development of customer service man... 2015-04-10
OA office automation system - OA office automation system is tomorrow technology... 2015-04-10
Chapters novel divider (ChapCuttor) - Chapter divider (ChapCuttor) by & have spent Black... 2015-04-10
Graduation design file (graphics algorithm design) - Reference image effect algorithm design the softwa... 2015-04-10
CheatEngine5.6 source code - Game cheat the 5.6 version of the source code, it ... 2015-04-10
Online ZhaXunWang science formula query V1.0 - Including junior middle school and high school sci... 2016-10-20
Observe science formula query v1.0 - Observe network science formulas 2016-10-20
Lele v1.1 QQ login system - "Le Le QQ Group landing system Ver1.1" * Fix QQ ... 2016-10-20
The new network domain name host distribution system V1.0 - Use Notepad to open \Global.asa idc1688 into your ... 2016-10-20
QQ group v2.1 release system - ha ha - "Copyright" This system is based on the Wu Meng de... 2016-10-20
Interesting content ASPCMS v1.0 - Update log: 2016-10-20
Residential feng shui fortune-telling v1.0 - The project according to the orientation of the ar... 2016-10-20
The self-help chain home beautiful - The self-help chain home beautiful 2016-10-20
EXW FLASH web site management system v2.0 - EXW FLASH introduction: EXW website management sys... 2016-10-20
WAP2.0 web site management system V1.0 - System installation steps 1, install the QuickWAP ... 2016-10-20

 Back to top