protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         this.txtFecha.Text = Utils.Now.ToString("dd/MM/yyyy");
         this.ddlCredito.DataBind();
         this.cargaDatosProductor();
         this.gridEstadodeCuenta.DataBind();
         this.dvEstadoGeneral.DataBind();
         if (Request.QueryString["data"] != null && this.loadqueryStrings(Request.QueryString["data"].ToString()) && this.myQueryStrings != null && this.myQueryStrings["creditoID"] != null)
         {
             this.ddlCredito.SelectedValue = this.myQueryStrings["creditoID"].ToString();
             this.cargaDatosProductor();
             this.gridEstadodeCuenta.DataBind();
             this.dvEstadoGeneral.DataBind();
             this.gridProductos.DataBind();
             Byte[] bytes;
             bytes = PdfCreator.PrintEstadoDeCuenta(this.ddlCredito.SelectedItem.Text,
                                                    ref this.dvEstadoGeneral,
                                                    ref this.gridProductos, ref this.GridView1, ref this.gridEstadodeCuenta, int.Parse(this.myQueryStrings["creditoID"].ToString()));
             Response.Clear();
             Response.ContentType = "application/pdf";
             Response.AddHeader("content-disposition", "attachment; filename=EstadoDeCuenta.pdf");
             Response.BinaryWrite(bytes);
             Response.Flush();
             Response.End();
         }
     }
 }
예제 #2
0
        public void HalloTest2()
        {
            const string dir = @"C:\Users\user\Documents\screenshoots\temp";

            //A4 210 mm x 297 mm
            const double pageWidthMM = 210.0;
            //const double r = 210.0 / 297.0;

            //"where the pdf should be";
            string filename = Path.Combine(dir, "allinone.pdf");

            //only screenshots in folder
            int numberOfPages = Directory.EnumerateFiles(dir).Count();

            //"where the screenshots are";
            string template = Path.Combine(dir, "csharp{0}.png");

            //get the common size: first picture -> size of all
            string firstPageDir = template.Replace("{0}", "1");

            System.Drawing.Image img = System.Drawing.Image.FromFile(firstPageDir);
            int    w    = img.Width;
            int    h    = img.Height;
            double rimg = (double)w / (double)h;

            Console.WriteLine("image: " + firstPageDir + "w: " + w + " h: " + h + " r: " + rimg);

            PdfCreator.hallo(pageWidthMM, pageWidthMM / rimg, filename, template, numberOfPages, false);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            string outputFilename = "bin\\output.pdf";

            using (FileStream outputStream = new FileStream(outputFilename, FileMode.Create, FileAccess.Write))
            {
                //----------------
                PdfCreator pdfCreator = new PdfCreator(outputStream);

                PdfResources     pdfRes        = pdfCreator.GetResources();
                PdfContentStream contentStream = pdfCreator.MakeContentStream();
                //----------------
                Fonet.Layout.FontInfo fontInfo = new Fonet.Layout.FontInfo();
                var fontSetup = new Fonet.Render.Pdf.FontSetup(
                    fontInfo, Fonet.Render.Pdf.FontType.Link);

                Fonet.Layout.FontState fontState = new Fonet.Layout.FontState(
                    fontInfo, "sans-serif", "normal",
                    "normal", 18000,
                    52);
                //----------------
                pdfCreator.OutputHeader();
                //----------------

                //simple page
                contentStream.BeginTextObject();
                contentStream.SetFont("F1", 18 * 1000);
                contentStream.SetFontColor(new Fonet.PdfColor(0, 0, 0));
                //----------------
                Fonet.Layout.TextPrinter textPrinter = new Fonet.Layout.TextPrinter();
                textPrinter.Reset(fontState, false);
                textPrinter.SetTextPos(100 * 1000, 100 * 1000);
                textPrinter.WriteText("Hello World!");
                textPrinter.PrintContentTo(contentStream);
                contentStream.CloseText();
                //----------------

                contentStream.DrawLine(0 * 1000, 0 * 1000, 70 * 1000, 50 * 1000,
                                       1 * 1000,
                                       new Fonet.PdfColor(255, 0, 0));


                contentStream.EndTextObject();
                //----------------
                int     w    = 800;
                int     h    = 600;
                PdfPage page = pdfCreator.MakePage(pdfRes, contentStream,
                                                   w,
                                                   h,
                                                   new string[0]);


                fontSetup.AddToResources(new PdfFontCreator(pdfCreator), pdfRes);
                pdfCreator.OutputTrailer();
                //----------------
                outputStream.Flush();
                outputStream.Close();
            }
        }
예제 #4
0
        protected void btnImprimeList_Click(object sender, EventArgs e)
        {
            this.grdvListEntPro.AllowPaging = false;
            this.grdvListEntPro.DataBind();
            float[] anchodecolumnas = new float[] { 3, 10, 10, 12, 10, 6, 9, 12, 7, 10, 10 };
            String  pathArchivotemp;

            pathArchivotemp = PdfCreator.printGridView("LISTA DE ENTRADAS DE PRODUCTO", grdvListEntPro, anchodecolumnas, PdfCreator.orientacionPapel.HORIZONTAL, PdfCreator.tamañoPapel.CARTA);
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment;filename=listausuarios.pdf");
            Response.WriteFile(pathArchivotemp);

            Response.Flush();
            Response.End();
            this.grdvListEntPro.AllowPaging = true;
            try
            {
                File.Delete(pathArchivotemp);
            }
            catch (Exception ex)
            {
                Logger.Instance.LogException(Logger.typeUserActions.DELETE, "ERROR BORRANDO ARCHIVO TEMP DE CHEQUES", ref ex);
            }
        }
예제 #5
0
        private void ButtonGeneratePdf_Click(object sender, RoutedEventArgs e)
        {
            PdfCreator pdfCreator = new PdfCreator(CBZ.StrConnection);
            string     path       = pdfCreator.GenerateEnterprisesPdf(CBZ);

            System.Diagnostics.Process.Start(path);
        }
        private void ButtonGeneratePdf_Click(object sender, RoutedEventArgs e)
        {
            PdfCreator pdfCreator = new PdfCreator(Bizz.MEFW.ObtainStrConnection());
            string     path       = pdfCreator.GenerateEnterpriseListPdf(Bizz, IndexableEnterpriseList, Bizz.Users);

            System.Diagnostics.Process.Start(path);
        }
        private void ButtonGeneratePdf_Click(object sender, RoutedEventArgs e)
        {
            if (ComboBoxCaseId.SelectedIndex == -1)
            {
                MessageBox.Show("Du har ikke valgt en sag. Der kan ikke genereres en PDF.", "Fejl Generer PDF", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            string     path       = "";
            PdfCreator pdfCreator = new PdfCreator(CBZ.StrConnection);

            if (RadioButtonShowAll.IsChecked.Value)
            {
                path = pdfCreator.GenerateSubEntrepeneursPdf(CBZ, IndexedSubEntrepeneurs);
            }
            if (RadioButtonShowOpen.IsChecked.Value)
            {
                path = pdfCreator.GenerateSubEntrepeneursPdf(CBZ, OpenIndexedSubEntrepeneurs);
            }
            if (RadioButtonShowChosen.IsChecked.Value)
            {
                path = pdfCreator.GenerateSubEntrepeneursPdf(CBZ, ChosenIndexedSubEntrepeneurs);
            }
            if (RadioButtonShowYesReceivedChosen.IsChecked.Value)
            {
                path = pdfCreator.GenerateSubEntrepeneursPdf(CBZ, YesReceivedChosenIndexedSubEntrepeneurs);
            }
            if (RadioButtonShowAgreement.IsChecked.Value)
            {
                path = pdfCreator.GenerateSubEntrepeneursPdfForAgreement(CBZ, ChosenIndexedSubEntrepeneurs);
            }
            Process.Start(path);
        }
예제 #8
0
        private void btnSalaryCalculator_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new CupOfCoffeeContext())
            {
                try
                {
                    var pdfFile = new PdfFile();
                    pdfFile.filename = "..\\..\\..\\PDFReport\\employee-sallaries.pdf";
                    pdfFile.title    = "Report: Employees sallaries";
                    pdfFile.data     = SalaryCalculator.Calculate(context);

                    PdfCreator.Create(pdfFile);

                    SalaryRecorder.Insert(pdfFile.data, context);

                    //var pathToAcroRd32 = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Adobe\Reader 11.0\Reader\AcroRd32.exe";
                    //var adobeInfo = new ProcessStartInfo(pathToAcroRd32, pdfFile.filename);

                    MessageBox.Show("The report for employees was successfully generated!",
                                    "Generated successfully",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information);

                    Process.Start(pdfFile.filename);
                }
                catch (Exception)
                {
                    MessageBox.Show("Cannot generate the report for employees!",
                                    "Generation failed",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
            }
        }
예제 #9
0
파일: TestCreator.cs 프로젝트: page2me/TeDA
        private static void TestPdf2PdfA()
        {
            string     pdfPath    = @"";
            string     outputPath = @"";
            PdfCreator pdfCreator = new PdfCreator();

            List <KeyValuePair <string, string> > properties = new List <KeyValuePair <string, string> >();

            properties.Add(new KeyValuePair <string, string>("Title", "ETDA Recommendation PDF/A-3U Example"));
            properties.Add(new KeyValuePair <string, string>("Author", "Author 1"));
            properties.Add(new KeyValuePair <string, string>("Author", "Author 2"));
            properties.Add(new KeyValuePair <string, string>("Subject", "Example Document"));
            properties.Add(new KeyValuePair <string, string>("Keywords", "ETDA Recommendation Basic Level Document"));

            // use default if not define
            OutputIntents outputIntents = new OutputIntents();

            outputIntents.colorProfilePath          = @"";
            outputIntents.outputConditionIdentifier = "sRGB IEC61966-2.1";
            outputIntents.outputCondition           = "";
            outputIntents.registryName = "http://www.color.org";
            outputIntents.info         = "sRGB IEC61966-2.1";

            byte[] pdfByte = File.ReadAllBytes(pdfPath);
            byte[] result  = pdfCreator.Pdf2PdfA(pdfByte, properties, outputIntents);
            //byte[] result = pdfCreator.Pdf2PdfA(pdfByte, properties, null);
            File.WriteAllBytes(outputPath, result);
        }
예제 #10
0
        public IActionResult GetActivitiesByDate([FromBody] Dates dates)
        {
            //try
            //{
            int id = Int32.Parse(User.Claims.First(c => c.Type == "UserId").Value);

            //List<Activity> activities = ActivityManager.GetActivitiesByDate(dates, id);
            //return Ok(activities);
            try
            {
                Report  report = ReportManager.GetReport(dates, id);
                byte [] bytes  = PdfCreator.createPDF(report);
                string  base64 = Convert.ToBase64String(bytes);
                return(Ok(base64));
            }
            catch
            {
                return(BadRequest());
            }
            //}

            /* catch
             * {
             *   return BadRequest();
             * }*/
        }
예제 #11
0
        public void IsPdfDocumentCreated()
        {
            PdfCreator pdf  = new PdfCreator("fdf");
            FileStream file = new FileStream(@"M:\Alior.pdf", FileMode.Open);

            Assert.IsNotNull(file);
        }
예제 #12
0
파일: TestCreator.cs 프로젝트: page2me/TeDA
        private static void TestWord2PDF()
        {
            string     pdfPath    = @"";
            string     outputPath = @"";
            PdfCreator pdfCreater = new PdfCreator();

            pdfCreater.Word2Pdf(pdfPath, outputPath);
        }
예제 #13
0
        /// <summary>
        /// Get info from DB and this method is redirected from the checkot metchod.
        /// takes in a new orderId from RedirectToAction("Invoice", new { orderId = newOrder.OrderId }) in checkout.
        /// </summary>
        /// <param name="orderId">A new order id</param>
        /// <returns>Returns a Invoice pdf whit info from the new created order and all receipt and shoppingcartcartitems.</returns>
        public IActionResult Invoice(int orderId)
        {
            var pdfCreator = new PdfCreator(_applicationDbContext);

            ViewData["PDF"] = pdfCreator.CreatePdf(orderId);

            return(View());
        }
예제 #14
0
    private void Start()
    {
        _generatePdfButton.onClick.AddListener(GeneratePdf);
        _sendEmailButton.onClick.AddListener(SendEmail);

        _pdfCreator = new PdfCreator();
        _pdfCreator.CreatePdf(OnPdfCreate);
    }
예제 #15
0
        private void CreatePdf_Click(object sender, RoutedEventArgs e)
        {
            Player     p      = (Player)listBoxUserPdf.SelectedItem;
            Route      r      = (Route)ListBoxRoutesPdf.SelectedItem;
            PdfCreator newPdf = new PdfCreator();

            newPdf.Treatment(r, p);
        }
예제 #16
0
        protected PdfPTable GetGanaderaData()
        {
            PdfPTable teibol = new PdfPTable(1);

            teibol.AddCell(PdfCreator.getCellWithFormat("AV. PATRIA OTE. #10", true, Element.ALIGN_LEFT));
            teibol.AddCell(PdfCreator.getCellWithFormat("AMECA, JALISCO 46600", true, Element.ALIGN_LEFT));
            teibol.AddCell(PdfCreator.getCellWithFormat("Tel. 01375 7581199 Fax 01375 7580262", true, Element.ALIGN_LEFT));
            return(teibol);
        }
예제 #17
0
        static void Main(string[] args)
        {
            string input  = @"input.txt";
            string output = @"output.pdf";

            IPdfCreator pdfCreator = new PdfCreator(new StyleFactory(), new ParagraphFactory());

            pdfCreator.CreatePDF(input, output);
        }
예제 #18
0
        private void ProcessRelatedFiles(List <PDFInfo> processList, int firstIndexInclusive, int lastIndexExclusive)
        {
            var pdfFileToUse = processList[firstIndexInclusive];

            logger.Info($"Creating PDF entry starting with {pdfFileToUse.FilePath}");

            //List used to cleanup files that were processed
            var processedFiles = new List <PDFInfo>();

            processedFiles.Add(pdfFileToUse);

            using (var creator = new PdfCreator())
            {
                for (var i = firstIndexInclusive; i < lastIndexExclusive; i++)
                {
                    var pdfinfo = processList[i];
                    for (int j = 0; j < pdfinfo.Images.Count; j++)
                    {
                        logger.Info($"Appending file {pdfinfo.FilePath} to {pdfFileToUse.FilePath}");

                        try
                        {
                            creator.AppendImageToPdf(pdfinfo.Images[j]);
                        }
                        catch (Exception ex)
                        {
                            logger.Error($"ERROR appending image to pdf.  File: {pdfinfo.FilePath}");
                            throw;
                        }

                        //free up memory
                        logger.Debug("Clearing memory for pdf " + pdfinfo.FilePath);
                        Array.Clear(pdfinfo.Images[j], 0, pdfinfo.Images[j].Length);
                    }
                    processedFiles.Add(pdfinfo);
                }

                pdfFileToUse.Pdf = creator.GetPdfDocumentBytes();
            }

            try
            {
                //Todo fix so that badsacans still remove the items from the process list
                SaveInfoToDatabase(pdfFileToUse);
                Cleanup(processedFiles, processList);
            }
            catch (Exception ex)
            {
                logger.Error("Error: " + ex.StackTrace);

                for (int i = firstIndexInclusive; i < lastIndexExclusive; i++)
                {
                    MoveFileToBadScans(processList[i].FilePath);
                    processList.Remove(processList[i]);
                }
            }
        }
예제 #19
0
        public ConverterData GetInvoiceConverterData(int invoiceId, string converterUrl, string storageUrl, string revisionId)
        {
            if (invoiceId <= 0)
            {
                throw new ArgumentException();
            }

            var invoice = DaoFactory.GetInvoiceDao().GetByID(invoiceId);

            if (invoice == null)
            {
                throw new ItemNotFoundException();
            }

            if (!CRMSecurity.CanAccessTo(invoice))
            {
                throw CRMSecurity.CreateSecurityException();
            }

            var converterData = new ConverterData
            {
                ConverterUrl = converterUrl,
                StorageUrl   = storageUrl,
                RevisionId   = revisionId,
                InvoiceId    = invoiceId
            };

            var existingFile = invoice.GetInvoiceFile();

            if (existingFile != null)
            {
                converterData.FileId = invoice.FileID;
                return(converterData);
            }

            if (string.IsNullOrEmpty(converterUrl) || string.IsNullOrEmpty(storageUrl) || string.IsNullOrEmpty(revisionId))
            {
                return(PdfCreator.StartCreationFileAsync(invoice));
            }
            else
            {
                var convertedFile = PdfCreator.GetConvertedFile(converterData);
                if (convertedFile != null)
                {
                    invoice.FileID = Int32.Parse(convertedFile.ID.ToString());
                    Global.DaoFactory.GetInvoiceDao().UpdateInvoiceFileID(invoice.ID, invoice.FileID);
                    Global.DaoFactory.GetRelationshipEventDao().AttachFiles(invoice.ContactID, invoice.EntityType, invoice.EntityID, new[] { invoice.FileID });

                    converterData.FileId = invoice.FileID;
                    return(converterData);
                }
                else
                {
                    return(converterData);
                }
            }
        }
예제 #20
0
 public NurseController(
     DrugstoreDbContext context,
     NurseUseCase nurseUseCase,
     UserManager <SystemUser> userManager)
 {
     this.context      = context;
     this.nurseUseCase = nurseUseCase;
     this.userManager  = userManager;
     pdfCreator        = new PdfCreator();
 }
예제 #21
0
        public void ErzeugeZwergBogenTest()
        {
            var zwerg = new Zwerg(1, 1, 1, Gesinnung.Rechtschaffen);

            using var zwergPdf = PdfCreator.ErzeugeZwergBogen(zwerg);

            using var f = File.Create("zweg_test.pdf");
            zwergPdf.CopyTo(f);
            f.Flush();
        }
예제 #22
0
        public virtual ActionResult ListPdf(GroupFilter filter)
        {
            filter.ForPrint = true;
            filter.ForPdf   = true;
            var x      = this.Html.Action("List", filter);
            var result = PdfCreator.Create(x.ToString());

            DownloadResult.AddContentDisposition(this.Response, "расписание.pdf");
            return(File(result, "application/pdf"));
        }
예제 #23
0
        public void ErzeugeDiebBogenTest()
        {
            var dieb = new Dieb(1, 1, 1, Gesinnung.Rechtschaffen);

            using var diebPdf = PdfCreator.ErzeugeDiebBogen(dieb);

            using var f = File.Create("dieb_test.pdf");
            diebPdf.CopyTo(f);
            f.Flush();
        }
예제 #24
0
        public void ErzeugeHalblingBogenTest()
        {
            var halbling = new Halbling(1, 3, 3, Gesinnung.Rechtschaffen);

            using var halblingPdf = PdfCreator.ErzeugeHalblingBogen(halbling);

            using var f = File.Create("halbling_test.pdf");
            halblingPdf.CopyTo(f);
            f.Flush();
        }
예제 #25
0
        public void ErzeugeKlerikerBogenTest()
        {
            var kleriker = new Kleriker(1, 1, 1, Gesinnung.Rechtschaffen);

            using var klerikerPdf = PdfCreator.ErzeugeKlerikerBogen(kleriker);

            using var f = File.Create("kleriker_test.pdf");
            klerikerPdf.CopyTo(f);
            f.Flush();
        }
예제 #26
0
        public void ErzeugeZauberkundigerBogenTest()
        {
            var zauberkundiger = new Zauberkundiger(1, 1, 1, Gesinnung.Rechtschaffen);

            using var zauberkundigerPdf = PdfCreator.ErzeugeZauberkundigerBogen(zauberkundiger);

            using var f = File.Create("zauberer_test.pdf");
            zauberkundigerPdf.CopyTo(f);
            f.Flush();
        }
예제 #27
0
        public void ErzeugeElfBogenTest()
        {
            var elf = new Elf(1, 1, 1, Gesinnung.Rechtschaffen);

            using var elfPdf = PdfCreator.ErzeugeElfBogen(elf);

            using var f = File.Create("elf_test.pdf");
            elfPdf.CopyTo(f);
            f.Flush();
        }
예제 #28
0
        protected PdfPTable GetFacturaData()
        {
            PdfPTable teibol = new PdfPTable(1);

            teibol.AddCell(PdfCreator.getCellWithFormat("FOLIO:", true, Element.ALIGN_LEFT));
            teibol.AddCell(PdfCreator.getCellWithFormat(this.txtFolio.Text, true, Element.ALIGN_LEFT));
            teibol.AddCell(PdfCreator.getCellWithFormat("FECHA:", true, Element.ALIGN_LEFT));
            teibol.AddCell(PdfCreator.getCellWithFormat(this.txtFecha.Text, true, Element.ALIGN_LEFT));
            return(teibol);
        }
예제 #29
0
        public void DownloadPdf(Dates dates)
        {
            int    id     = Int32.Parse(User.Claims.First(c => c.Type == "UserId").Value);
            Report report = ReportManager.GetReport(dates, id);

            byte [] bytes  = PdfCreator.createPDF(report);
            string  base64 = Convert.ToBase64String(bytes);

            Response.ContentType = "application/pdf";
            Response.Body.WriteAsync(bytes);
        }
예제 #30
0
        public void ErzeugeNullerBogenTest()
        {
            var random     = new Random();
            var factory    = new CharacterFactory(random);
            var characters = new[] { factory.Default(), factory.Default(), factory.Default(), factory.Default() };

            using var nullPdf = PdfCreator.ErzeugeNullerBogen(characters);
            using var f       = File.Create("null_test.pdf");
            nullPdf.CopyTo(f);
            f.Flush();
        }